|
#!/bin/sh |
|
# |
|
# fleet-drone |
|
# |
|
# chkconfig: - 85 15 |
|
# description: |
|
# processname: fleet-drone |
|
# config: /etc/node/fleet-drone.conf |
|
# pidfile: /var/run/fleet-drone.pid |
|
|
|
# Source function library. |
|
source /etc/rc.d/init.d/functions |
|
|
|
# Source networking configuration. |
|
source /etc/sysconfig/network |
|
|
|
# Check that networking is up. |
|
[ "$NETWORKING" = "no" ] && exit 0 |
|
|
|
# Source fleet-drone configuration. |
|
source /etc/node/fleet-drone.conf |
|
|
|
exec="$NODE_PATH/node $NODE_PATH/fleet-drone" |
|
prog=$(basename $exec) |
|
PATH=$NODE_PATH:$PATH |
|
|
|
[ -e /etc/sysconfig/$prog ] && source /etc/sysconfig/$prog |
|
|
|
lockfile=/var/lock/subsys/fleet-drone |
|
|
|
start() { |
|
echo -n $"Starting $prog: " |
|
[ -d /opt/fleet-drone ] || mkdir /opt/fleet-drone |
|
cd /opt/fleet-drone |
|
# start it up here, usually something like "daemon $exec" |
|
daemon NODE_ENV=$NODE_ENV $exec --hub $HUB --secret $HUB_SECRET & |
|
echo $! > /var/run/fleet-drone.pid |
|
retval=$? |
|
echo |
|
[ $retval -eq 0 ] && touch $lockfile |
|
return $retval |
|
} |
|
|
|
stop() { |
|
echo -n $"Stopping $prog: " |
|
# stop it here, often "killproc $prog" |
|
killproc $prog |
|
retval=$? |
|
echo |
|
[ $retval -eq 0 ] && rm -f $lockfile |
|
return $retval |
|
} |
|
|
|
restart() { |
|
stop |
|
start |
|
} |
|
|
|
force_reload() { |
|
restart |
|
} |
|
|
|
fdr_status() { |
|
status $prog |
|
} |
|
|
|
case "$1" in |
|
start|stop|restart) |
|
$1 |
|
;; |
|
status) |
|
fdr_status |
|
;; |
|
condrestart|try-restart) |
|
[ ! -f $lockfile ] || restart |
|
;; |
|
*) |
|
echo $"Usage: $0 {start|stop|status|restart|try-restart}" |
|
exit 2 |
|
esac |