-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathands-taskprocessor
More file actions
executable file
·99 lines (87 loc) · 1.71 KB
/
Copy pathands-taskprocessor
File metadata and controls
executable file
·99 lines (87 loc) · 1.71 KB
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/bin/sh
#
# ands-taskmanager Startup script for the ANDS Task Manager
# chkconfig: - 86 15
# description: The ANDS Task Manager does tasking management.
### BEGIN INIT INFO
# Provides:
# Required-Start:
# Required-Stop:
# Should-Start:
# Should-Stop:
# Default-Start:
# Default-Stop:
# Short-Description: This is the ANDS Background Task Manager.
# Description:
### END INIT INFO
# Source function library.
. /etc/init.d/functions
exec_python="/usr/local/bin/python3"
exec="/opt/ands-taskmanager/task_processor_daemon.py"
prog="ands-taskmanager"
[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
pidfile=/opt/ands-taskmanager/daemon.pid
lockfile=/var/lock/subsys/$prog
start () {
if [ $UID -ne 0 ] ; then
echo $"User has insufficient privilege."
exit 4
fi
[ -x $exec_python ] || exit 5
[ -f $exec ] || exit 6
echo -n $"Starting $prog: "
$exec_python $exec start
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
}
stop () {
if [ $UID -ne 0 ] ; then
echo $"User has insufficient privilege."
exit 4
fi
echo -n $"Stopping $prog: "
$exec_python $exec stop
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
}
restart() {
stop
start
}
status() {
if [ $UID -ne 0 ] ; then
echo $"User has insufficient privilege."
exit 4
fi
$exec_python $exec status
retval=$?
echo
}
usage() {
echo $"Usage: $0 {start|stop|status|restart}"
}
case "$1" in
start)
$1
;;
stop)
$1
;;
restart)
$1
;;
status)
status
;;
usage)
usage
exit 0
;;
*)
usage
exit 2
esac
exit $?
# vim:syntax=sh