blob: 43a0e06273ed8d09d1171eedb6e34bf6c9c0df0e (
plain)
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
|
#!/bin/sh
# chkconfig: 235 99 10
# description: Start or stop the Usermin server
#
### BEGIN INIT INFO
# Provides: usermin
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 2 3 5
# Default-Stop: 0 1 6
# Description: Start or stop the Usermin server
### END INIT INFO
start=/etc/usermin/start
stop=/etc/usermin/stop
lockfile=/var/lock/subsys/usermin
confFile=/etc/usermin/miniserv.conf
pidFile=/var/usermin/miniserv.pid
etc_dir=/etc/usermin
name='Usermin'
case "$1" in
'start')
$start >/dev/null 2>&1 </dev/null
RETVAL=$?
if [ "$RETVAL" = "0" ]; then
touch $lockfile >/dev/null 2>&1
fi
;;
'stop')
$stop
RETVAL=$?
if [ "$RETVAL" = "0" ]; then
rm -f $lockfile
fi
;;
'status')
pidfile=`grep "^pidfile=" $confFile | sed -e 's/pidfile=//g'`
if [ "$pidfile" = "" ]; then
pidfile=$pidFile
fi
if [ -s $pidfile ]; then
pid=`cat $pidfile`
kill -0 $pid >/dev/null 2>&1
if [ "$?" = "0" ]; then
echo "$name (pid $pid) is running"
RETVAL=0
else
echo "$name is stopped"
RETVAL=1
fi
else
echo "$name is stopped"
RETVAL=1
fi
;;
'restart')
$stop && $start
RETVAL=$?
;;
'setup')
echo "Entering $etc_dir .."
cd $etc_dir
echo "..done"
echo ""
echo "Etering Setup ..."
./setup.sh
echo "..done"
echo ""
;;
*)
echo "Usage: $0 { start | stop | restart | setup }"
RETVAL=1
;;
esac
exit $RETVAL
|