diff options
Diffstat (limited to 'meta-openstack/recipes-support/salt/files/salt-syndic')
| -rwxr-xr-x | meta-openstack/recipes-support/salt/files/salt-syndic | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/meta-openstack/recipes-support/salt/files/salt-syndic b/meta-openstack/recipes-support/salt/files/salt-syndic new file mode 100755 index 0000000..6d5cdff --- /dev/null +++ b/meta-openstack/recipes-support/salt/files/salt-syndic | |||
| @@ -0,0 +1,111 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | ### BEGIN INIT INFO | ||
| 3 | # Provides: salt-syndic | ||
| 4 | # Required-Start: $remote_fs $network | ||
| 5 | # Required-Stop: $remote_fs $network | ||
| 6 | # Default-Start: 2 3 4 5 | ||
| 7 | # Default-Stop: 0 1 6 | ||
| 8 | # Short-Description: salt syndic control daemon | ||
| 9 | # Description: This is a daemon for the master of masters | ||
| 10 | ### END INIT INFO | ||
| 11 | |||
| 12 | # Author: Michael Prokop <mika@debian.org> | ||
| 13 | |||
| 14 | PATH=/sbin:/usr/sbin:/bin:/usr/bin | ||
| 15 | DESC="salt syndic control daemon" | ||
| 16 | NAME=salt-syndic | ||
| 17 | DAEMON=/usr/bin/salt-syndic | ||
| 18 | DAEMON_ARGS="-d" | ||
| 19 | PIDFILE=/var/run/$NAME.pid | ||
| 20 | SCRIPTNAME=/etc/init.d/$NAME | ||
| 21 | |||
| 22 | # Exit if the package is not installed | ||
| 23 | [ -x "$DAEMON" ] || exit 0 | ||
| 24 | |||
| 25 | # Read configuration variable file if it is present | ||
| 26 | [ -r /etc/default/$NAME ] && . /etc/default/$NAME | ||
| 27 | |||
| 28 | # Source function library. | ||
| 29 | . /etc/init.d/functions | ||
| 30 | |||
| 31 | do_start() { | ||
| 32 | # Return | ||
| 33 | # 0 if daemon has been started | ||
| 34 | # 1 if daemon was already running | ||
| 35 | # 2 if daemon could not be started | ||
| 36 | pid=$(pidof -x $DAEMON) | ||
| 37 | if [ -n "$pid" ] ; then | ||
| 38 | return 1 | ||
| 39 | fi | ||
| 40 | |||
| 41 | start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \ | ||
| 42 | $DAEMON_ARGS \ | ||
| 43 | || return 2 | ||
| 44 | } | ||
| 45 | |||
| 46 | do_stop() { | ||
| 47 | # Return | ||
| 48 | # 0 if daemon has been stopped | ||
| 49 | # 1 if daemon was already stopped | ||
| 50 | # 2 if daemon could not be stopped | ||
| 51 | # other if a failure occurred | ||
| 52 | start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME | ||
| 53 | RETVAL="$?" | ||
| 54 | [ "$RETVAL" = 2 ] && return 2 | ||
| 55 | rm -f $PIDFILE | ||
| 56 | return "$RETVAL" | ||
| 57 | } | ||
| 58 | |||
| 59 | case "$1" in | ||
| 60 | start) | ||
| 61 | [ "$VERBOSE" != no ] && echo "Starting $DESC" "$NAME" | ||
| 62 | do_start | ||
| 63 | case "$?" in | ||
| 64 | 0|1) [ "$VERBOSE" != no ] && echo OK ;; | ||
| 65 | 2) [ "$VERBOSE" != no ] && echo FAILED ;; | ||
| 66 | esac | ||
| 67 | ;; | ||
| 68 | stop) | ||
| 69 | [ "$VERBOSE" != no ] && echo "Stopping $DESC" "$NAME" | ||
| 70 | do_stop | ||
| 71 | case "$?" in | ||
| 72 | 0|1) [ "$VERBOSE" != no ] && echo OK ;; | ||
| 73 | 2) [ "$VERBOSE" != no ] && echo FAILED ;; | ||
| 74 | esac | ||
| 75 | ;; | ||
| 76 | status) | ||
| 77 | pid=`pidof -x $DAEMON` | ||
| 78 | if [ -n "$pid" ]; then | ||
| 79 | echo "$NAME (pid $pid) is running ..." | ||
| 80 | else | ||
| 81 | echo "$NAME is stopped" | ||
| 82 | fi | ||
| 83 | ;; | ||
| 84 | #reload) | ||
| 85 | # not implemented | ||
| 86 | #;; | ||
| 87 | restart|force-reload) | ||
| 88 | echo "Restarting $DESC" "$NAME" | ||
| 89 | do_stop | ||
| 90 | case "$?" in | ||
| 91 | 0|1) | ||
| 92 | do_start | ||
| 93 | case "$?" in | ||
| 94 | 0) echo OK ;; | ||
| 95 | 1) echo FAILED ;; # Old process is still running | ||
| 96 | *) echo FAILED ;; # Failed to start | ||
| 97 | esac | ||
| 98 | ;; | ||
| 99 | *) | ||
| 100 | # Failed to stop | ||
| 101 | echo FAILED | ||
| 102 | ;; | ||
| 103 | esac | ||
| 104 | ;; | ||
| 105 | *) | ||
| 106 | echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2 | ||
| 107 | exit 3 | ||
| 108 | ;; | ||
| 109 | esac | ||
| 110 | |||
| 111 | exit 0 | ||
