blob: 30fa1d07cf48ccb8159d12fc217720ed375c25fd (
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
|
#! /bin/sh
CMD=local-persist
local_persist_start() {
if [ -n "$(/sbin/pidof $CMD)" ]; then
echo >&2 "$0: $CMD is already running"
else
/usr/bin/$CMD | /usr/bin/logger -t $CMD -p daemon.info &
fi
}
local_persist_stop() {
/usr/bin/pkill $CMD
}
local_persist_status() {
pid=$(/sbin/pidof $CMD)
if [ -n "$pid" ]; then
echo "$CMD is running (pid $pid)"
else
echo "$CMD is not running"
fi
}
case $1 in
start)
local_persist_start
;;
stop)
local_persist_stop
;;
restart)
local_persist_stop
local_persist_start
;;
status)
local_persist_status
esac
|