blob: 16b83afc4f89a8bdf396fe8b7a7754dae9b49297 (
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
79
80
81
82
83
84
85
86
87
88
89
90
|
#!/bin/sh
# startup script for seggetd
if [ -f /etc/rc.d/init.d/functions ]; then
if [ -f /etc/slackware-version ]; then
SYS_F="SL"
else
. /etc/rc.d/init.d/functions
SYS_F="RH"
fi
elif [ -x /sbin/startproc ]; then
SYS_F="Su"
elif [ -x /sbin/start-stop-daemon ]; then
SYS_F="De"
fi
DAEMON=/usr/sbin/seggetd/segget
CONF_DIR=/etc/seggetd
LOCKFILE=/var/lock/subsys/seggetd
export PATH=$PATH:/usr/local/sbin:/usr/local/bin
segget_start ()
{
echo -n "Starting ${DAEMON}: "
if [ "$SYS_F" = "RH" ]; then
daemon ${DAEMON} --conf-dir=${CONF_DIR}
[ "$?" = "0" ] && touch ${LOCKFILE}
echo "."
elif [ "$SYS_F" = "Su" ]; then
startproc ${DAEMON} --conf-dir=${CONF_DIR}
echo "."
elif [ "$SYS_F" = "De" ]; then
start-stop-daemon --start --quiet --oknodo --exec ${DAEMON} -- --conf-dir=${CONF_DIR}
echo "."
else
`${DAEMON} --conf-dir=${CONF_DIR}`
fi
}
segget_stop ()
{
echo -n "Shutting down ${DAEMON}: "
if [ "$SYS_F" = "De" ]; then
start-stop-daemon --stop --quiet --oknodo --signal 15 --exec ${DAEMON}
echo "."
elif [ "$SYS_F" = "SL" ]; then
kill -KILL `pidof ${DAEMON}`
[ "$?" = "0" ] && rm -f ${LOCKFILE}
echo
else
killproc ${DAEMON}
[ "$?" = "0" ] && rm -f ${LOCKFILE}
echo
fi
}
case $1 in
start)
segget_start
;;
stop)
segget_stop
;;
status)
pid=`pidof ${DAEMON}`
if [ "${pid}" ]; then
echo "${DAEMON} is running, pid: $pid"
else
echo "${DAEMON} is not running"
fi
;;
restart)
segget_stop
segget_start
;;
*)
echo "Usage: seggetd {start|stop|restart|status}"
exit 1
;;
esac
exit 0
|