-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathserver-ctl
More file actions
executable file
·96 lines (85 loc) · 1.83 KB
/
server-ctl
File metadata and controls
executable file
·96 lines (85 loc) · 1.83 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
#!/bin/sh
#
# Configuration
#
CONFFILE="/var/roundup/server-config.ini"
# this will end up with extra space, but it should be ignored in the script
PIDFILE=`grep '^pidfile' ${CONFFILE} | awk -F = '{print $2}' `
SERVER="/usr/local/bin/roundup-server -C ${CONFFILE}"
ERROR=0
ARGV="$@"
if [ "x$ARGV" = "x" ] ; then
ARGS="help"
fi
if [ -z "${PIDFILE}" ] ; then
echo "pidfile option must be set in configuration file"
exit 1
fi
for ARG in $@ $ARGS
do
# check for pidfile
if [ -f $PIDFILE ] ; then
PID=`cat $PIDFILE`
if [ "x$PID" != "x" ] && kill -0 $PID 2>/dev/null ; then
STATUS="roundup-server (pid $PID) running"
RUNNING=1
else
STATUS="roundup-server (pid $PID?) not running"
RUNNING=0
fi
else
STATUS="roundup-server (no pid file) not running"
RUNNING=0
fi
case $ARG in
start)
if [ $RUNNING -eq 1 ] ; then
echo "$0 $ARG: roundup-server (pid $PID) already running"
continue
fi
if $SERVER ; then
echo "$0 $ARG: roundup-server started"
else
echo "$0 $ARG: roundup-server could not be started"
ERROR=1
fi
;;
condstart)
if [ $RUNNING -eq 1 ] ; then
continue
fi
if $SERVER ; then
echo "$0 $ARG: roundup-server started"
else
echo "$0 $ARG: roundup-server could not be started"
ERROR=1
fi
;;
stop)
if [ $RUNNING -eq 0 ] ; then
echo "$0 $ARG: $STATUS"
continue
fi
if kill $PID ; then
echo "$0 $ARG: roundup-server stopped"
else
echo "$0 $ARG: roundup-server could not be stopped"
ERROR=2
fi
;;
status)
echo $STATUS
;;
*)
echo "usage: $0 (start|condstart|stop|status)"
cat <<EOF
start - start roundup-server
condstart - start roundup-server if it's not running
stop - stop roundup-server
status - display roundup-server status
EOF
ERROR=3
;;
esac
done
exit $ERROR