-
-
Save zembutsu/7640108 to your computer and use it in GitHub Desktop.
Serf SysV Init script usage:
# /sbin/chkconfig --add serf
# /sbin/chkconfig serf on
# /sbin/service serf start
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# chkconfig: - 89 11 | |
# description: serf daemon | |
# processname: serf | |
# config: /etc/serf.conf | |
# Default-Start: | |
# Default-Stop: 0 1 2 3 4 5 6 | |
# Description: serf agent daemon | |
# Source function library. | |
. /etc/rc.d/init.d/functions | |
exec=/usr/local/bin/serf | |
prog=${exec##*/} | |
conf=/etc/serf.conf | |
lockfile=/var/lock/subsys/serf | |
start () | |
{ | |
echo -n $"Starting Serf:" | |
if [ -f $conf ]; then | |
$exec agent -config-file=$conf & | |
else | |
$exec agent & | |
fi | |
#$exec agent > /dev/null & | |
stat=$? | |
echo | |
[ $stat -eq 0 ] && touch $lockfile | |
return $stat | |
} | |
stop() | |
{ | |
echo -n $"Shutting down Serf:" | |
killproc $prog | |
stat=$? | |
echo | |
[ $stat -eq 0 ] && rm -f $lockfile | |
return $stat | |
} | |
restart() | |
{ | |
stop | |
start | |
} | |
monitor () | |
{ | |
echo -n $"Monitoring Serf:" | |
$exec monitor & | |
return | |
} | |
leave() | |
{ | |
echo -n $"Force-leave Serf:" | |
$exec force-leave node & | |
# stop | |
stat=$? | |
echo | |
[ $stat -eq 0 ] && rm -f $lockfile | |
return $stat | |
} | |
case "$1" in | |
start|stop|restart|monitor|leave) | |
$1 | |
;; | |
force-reload) | |
restart | |
;; | |
status) | |
status $prog | |
;; | |
*) | |
echo $"Usage: $0 {start|stop|status|restart|monitor|leave}" | |
exit 2 | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment