-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfes
executable file
·85 lines (74 loc) · 1.44 KB
/
fes
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
#!/bin/bash
# chkconfig: 345 20 80
# description: File Export Service start/shutdown script
# processname: fes
# config: /etc/avail/fes/fes.cfg
#
# source function library
. /etc/rc.d/init.d/functions
# Path to fes install folder
FES=/opt/fes/fes.py
FES_OPTS="--debug --daemon"
LOCKFILE=/var/lock/subsys/fes
RETVAL=0
d_start() {
echo -n $"Starting FES service: "
daemon $FES $FES_OPTS && success || failure
RETVAL=$?
echo
return $RETVAL
}
d_stop() {
echo -n $"Stopping FES service: "
if [ -f $LOCKFILE ]; then
killproc -p $LOCKFILE $FES
else
failure $"Stopping FES service"
fi
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f $LOCKFILE
echo
}
d_restart() {
d_stop
sleep 1
d_start
}
d_status() {
status -p $LOCKFILE $FES
}
d_status_q() {
d_status >/dev/null 2>&1
}
case "$1" in
start)
d_status_q && exit 0
if [ $? -ne 0 -a -f $LOCKFILE ]; then
echo 'Removing lock file from dead pid.'
rm -f $LOCKFILE
fi
d_start
;;
stop)
if ! d_status_q; then
rm -rf $LOCKFILE
exit 0
fi
d_stop
;;
restart)
d_restart
;;
status)
d_status
RETVAL=$?
if [ $RETVAL -eq 3 -a -f $LOCKFILE ]; then
RETVAL=2
fi
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
RETVAL=2
;;
esac
exit $RETVAL