forked from openvetsim/sim-mgr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
simmgr.init
executable file
·67 lines (57 loc) · 1.57 KB
/
simmgr.init
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
#! /bin/sh
### BEGIN INIT INFO
# Provides: simmgr
# Required-Start: $local_fs $remote_fs $syslog
# Required-Stop:
# X-Start-Before: rmnologin
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Simulation Manager for Canine Sim
# Description: Provide execution of the Simulation Manager and Pulse/Respiration Sync
### END INIT INFO
. /lib/lsb/init-functions
SIMMGR_DAEMON=/usr/local/bin/simmgr
PULSE_DAEMON=/usr/local/bin/simpulse
PIDDIR=/var/run/simmgr
S_PIDFILE=$PIDDIR/simmgr.pid
P_PIDFILE=$PIDDIR/simpulse.pid
DAEMONUSER=simmgr
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
test -x $SIMMGR_DAEMON || exit 0
test -x $PULSE_DAEMON || exit 0
simmgr_start () {
log_daemon_msg "Starting Simulation Manager"
if [ ! -d $PIDDIR ]; then
mkdir -p $PIDDIR
chown $DAEMONUSER:$DAEMONUSER $PIDDIR
fi
$SIMMGR_DAEMON
$PULSE_DAEMON
log_end_msg ${status}
}
simmgr_stop() {
log_daemon_msg "Stopping Simulation Manager"
kill $(cat $S_PIDFILE)
kill $(cat $P_PIDFILE)
killall obsmon
log_end_msg $?
}
case "$1" in
start|stop)
simmgr_${1}
;;
reload|restart)
simmgr_stop
simmgr_start
;;
## status_of_proc -p $S_PIDFILE "$SIMMGR_DAEMON" "status of simmgr" && exit 0 || exit $?
status)
status_of_proc -p $S_PIDFILE "$SIMMGR_DAEMON" "status of simmgr" || exit $?
status_of_proc -p $P_PIDFILE "$SIMMGR_DAEMON" "status of simpulse" || exit $?
;;
*)
echo "Usage: $N {start|stop|reload|restart|status}" >&2
exit 1
;;
esac
exit 0