-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinitscript.sh
55 lines (48 loc) · 1.24 KB
/
initscript.sh
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
#!/bin/sh
### BEGIN INIT INFO
# Provides: texmond
# Required-Start: $remote_fs $network
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Logging of Texecom panel events
# Description: Logs events from a Texecom panel connected via serial port.
### END INIT INFO
PATH=/sbin:/bin:/usr/bin
NAME=texmond
DESC="logging of Texecom panel events"
PID_FILE=/var/run/texmond.pid
DAEMON=/opt/texmond/texmond.exe
MONO=/usr/bin/mono-sgen
test -x $MONO || exit 0
. /lib/lsb/init-functions
set -e
case "$1" in
start)
log_daemon_msg "Starting $DESC" "$NAME"
start-stop-daemon --start -m --pidfile $PID_FILE --exec "$MONO" -d $(dirname "$DAEMON") --background --quiet -- $DAEMON
log_end_msg $?
;;
stop)
log_daemon_msg "Stopping $DESC" "$NAME"
start-stop-daemon --stop --pidfile $PID_FILE --exec "$MONO"
log_end_msg $?
rm -f $PID_FILE
;;
restart)
$0 stop
sleep 2
$0 start
;;
status)
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
;;
trigger)
start-stop-daemon --stop --signal USR1 --pidfile $PID_FILE --exec $MONO
;;
*)
echo "Usage: $0 {start|stop|restart|status|trigger}" >&2
exit 1
;;
esac
exit 0