public
Last active

  • Download Gist
init.d-fleet-drone.sh
Shell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
#!/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
monit.d-fleet-drone
1 2 3 4 5 6 7
check process fleet-drone with pidfile /var/run/fleet-drone.pid
group application
group nodejs
start program = "/etc/init.d/fleet-drone start"
stop program = "/etc/init.d/fleet-drone stop"
 
check file node.log with path /var/log/node.log

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.