#!/bin/bash #! /bin/sh ### BEGIN INIT INFO # Provides: swiftiply # Should-Start: $local_fs # Should-Stop: $local_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: swiftiply - Back-end agnostic load balancer # Description: swiftiply - Back-end agnostic load balancer ### END INIT INFO PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/local/bin/swiftiply NAME=swiftiply DESC=swiftiply PIDFILE=<%= swiftiply_pid_file %> ARGS="-c <%= swiftiply_conf %>" EVENT=1 case "$1" in start) echo -n "Starting $DESC: " : > <%= swiftiply_conf %> find <%= swiftiply_conf_dir %> -wholename <%= swiftiply_conf %> -o -type f , -type l -exec cat '{}' \; >> <%= swiftiply_conf %> start-stop-daemon --start --quiet --pidfile $PIDFILE -m --exec $DAEMON -- $ARGS echo "$NAME." ;; stop) echo -n "Stopping $DESC: " start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE --exec $DAEMON echo "$NAME." rm -f $PIDFILE ;; stop) echo -n "Reloading $DESC" kill -HUP `cat $PIDFILE` echo "$NAME." rm -f $PIDFILE ;; restart|force-reload) echo -n "Restarting $DESC: " start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE rm -f $PIDFILE start-stop-daemon --start --quiet --exec $ARGS echo "$NAME." ;; *) N=/etc/init.d/$NAME echo "Usage: $N {start|stop|reload|restart|force-reload}" >&2 exit 1 ;; esac exit 0