Created
July 29, 2015 11:49
-
-
Save hamilyon/6646fd04a7d0e37278ce to your computer and use it in GitHub Desktop.
etcd upstart config
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 | |
| ### BEGIN INIT INFO | |
| # Provides: etcd | |
| # Required-Start: $network $remote_fs $syslog | |
| # Required-Stop: $network $remote_fs $syslog | |
| # Default-Start: 2 3 4 5 | |
| # Default-Stop: 1 | |
| # Short-Description: Start etcd daemon | |
| ### END INIT INFO | |
| PATH=/sbin:/bin:/usr/sbin:/usr/bin | |
| . /lib/lsb/init-functions | |
| prog="etcd" | |
| prog_bin="/opt/etcd-v2.1.1-linux-amd64/$prog" | |
| pidfile=/var/run/$prog.pid | |
| desc="etcd shared configuration and service discovery daemon" | |
| if ! [ -f $prog_bin ]; then | |
| echo "$prog binary not found." | |
| exit 5 | |
| fi | |
| if [ -r /etc/default/$prog ]; then | |
| . /etc/default/$prog | |
| fi | |
| echo $ETCD_OPTS | |
| start() { | |
| log_daemon_msg "Starting etcd server" "$prog" | |
| start-stop-daemon --start --quiet --oknodo --background --pidfile $pidfile --make-pidfile --exec $prog_bin -- $ETCD_OPTS | |
| status=$? | |
| log_end_msg $status | |
| } | |
| stop() { | |
| log_begin_msg "Stopping etcd server" | |
| start-stop-daemon --stop --pidfile "$pidfile" | |
| status=$? | |
| if [ -f $pidfile ]; then | |
| rm $pidfile | |
| fi | |
| log_end_msg $status | |
| } | |
| restart() { | |
| stop | |
| start | |
| } | |
| status() { | |
| status_of_proc -p "$pidfile" "$prog_bin" etcd | |
| } | |
| case "$1" in | |
| start) start;; | |
| stop) stop;; | |
| restart) restart;; | |
| status) status;; | |
| *) echo "Usage: $0 {start|stop|restart|status}" | |
| RETVAL=2;; | |
| esac | |
| exit $RETVAL | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment