Last active
          November 21, 2017 14:07 
        
      - 
      
- 
        Save aputs/1daff678838441b5195d to your computer and use it in GitHub Desktop. 
Revisions
- 
        aputs revised this gist May 5, 2014 . 1 changed file with 3 additions and 6 deletions.There are no files selected for viewingThis 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 charactersOriginal file line number Diff line number Diff line change @@ -27,14 +27,11 @@ start() { [[ $started =~ running ]] && echo $started && return 1 echo -n $"Starting $prog: " $ETCD_EXEC 3>&1 2>&1 1>&$ETCD_LOGFILE & RETVAL=$? echo $! > $ETCD_PIDFILE [[ $RETVAL ]] && success || failure [[ $RETVAL ]] && touch "$ETCD_LOCKFILE" return $RETVAL } 
- 
        aputs created this gist May 5, 2014 .There are no files selected for viewingThis 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,76 @@ #!/bin/bash # Startup script for etcd # # chkconfig: 2345 20 80 # description: Starts and stops etcd . /etc/init.d/functions prog="etcd" ETCD_BIN=$(which etcd 2> /dev/null) prog=$(basename "$ETCD_BIN") desc="etcd shared configuration and service discovery daemon" if [[ ! -e $ETCD_BIN ]]; then echo "$prog binary not found." exit 5 fi ETCD_LOCKFILE="/var/lock/subsys/$prog" ETCD_LOGFILE=/var/log/etcd/etcd.log ETCD_PIDFILE=/var/run/etcd.pid ETCD_CONFIG=/etc/etcd.conf ETCD_EXEC="$ETCD_BIN -config $ETCD_CONFIG" start() { started=$(status -p "$ETCD_PIDFILE" "$ETCD_BIN") [[ $started =~ running ]] && echo $started && return 1 echo -n $"Starting $prog: " daemon --user etcd $ETCD_EXEC 3>&1 2>&1 1>&$ETCD_LOGFILE & RETVAL=$? [[ $RETVAL ]] && success || failure echo [ $RETVAL -eq 0 ] && { pidof $ETCD_BIN > $ETCD_PIDFILE touch "$ETCD_LOCKFILE" } return $RETVAL } stop() { echo -n $"Stopping $prog: " killproc -p "$ETCD_PIDFILE" "$ETCD_BIN" RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -fr "$ETCD_LOCKFILE" return $RETVAL } case $1 in start) start ;; stop) stop ;; restart) stop start ;; status) status "$ETCD_BIN" RETVAL=$? ;; *) echo "Usage: $0 {start|stop|restart|status}" RETVAL=1 ;; esac exit $RETVAL