Skip to content

Instantly share code, notes, and snippets.

@dynax60
Created March 30, 2011 05:24
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save dynax60/893903 to your computer and use it in GitHub Desktop.
Save dynax60/893903 to your computer and use it in GitHub Desktop.
Example of Hypnotoad startup-script for linux
#!/bin/bash
#
# Init file for Ping server daemon
#
# chkconfig: 2345 55 25
# description: Ping server daemon
#
# processname: ping
# pidfile: /var/run/ping.pid
# Source function library
if [ -f /etc/init.d/functions ] ; then
. /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ] ; then
. /etc/rc.d/init.d/functions
else
exit 1
fi
unset TMPDIR
RETVAL=0
PING="/usr/local/app/ping/mojo/script/hypnotoad"
APPLICATION_CONF="/usr/local/app/ping/ping.conf"
export MOJO_MODE=production
export HYPNOTOAD_APP="/usr/local/app/ping/ping.pl"
[ -f $APPLICATION_CONF ] || exit 3
start()
{
echo -n $"Starting ping service: "
daemon $PING "--config $APPLICATION_CONF" 2>/dev/null
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/ping || RETVAL=1
return $RETVAL
}
stop()
{
echo -n $"Shutting down ping service: "
killproc ping
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/ping
echo
return $RETVAL
}
reload()
{
echo -n $"Reloading ping service: "
killproc ping -SIGUSR2
RETVAL=$?
echo
return $RETVAL
}
case "$1" in
start)
start
;;
stop)
stop
;;
reload)
reload
;;
restart)
stop
start
;;
status)
status ping
;;
*)
echo $"Usage: $0 {start|stop|reload|restart|status}"
exit 2
esac
exit $?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment