Last active
August 29, 2015 13:56
-
-
Save vertis/9264901 to your computer and use it in GitHub Desktop.
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
| # Serf Agent | |
| description "Serf Agent" | |
| start on (local-filesystems and net-device-up IFACE!=lo) | |
| stop on runlevel [06] | |
| kill signal INT # Use SIGINT instead of SIGTERM so serf can depart the cluster. | |
| respawn # Restart the process if it dies and GOAL was not 'stopping'. | |
| kill timeout 90 # Allow 90 seconds for serf to die before sending SIGKILL. | |
| env SERF=/usr/local/bin/serf | |
| env CFG_FOLDER=/etc/serf/ | |
| pre-start script | |
| install -d -g root -o root $CFG_FOLDER; # make the empty directory, owned by root. | |
| end script | |
| post-start script | |
| /usr/local/bin/serf-findpeers $(ifconfig eth0 | grep -oE "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" | head -n 1) 2>&1 >> /var/log/serf-join.log & | |
| end script | |
| exec $SERF agent -config-dir=$CFG_FOLDER | |
| post-stop exec sleep 10 # Wait ten seconds before respawn attempts. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment