-
Notifications
You must be signed in to change notification settings - Fork 0
/
polite-hwclock-hctosys.systemv
executable file
·63 lines (56 loc) · 1.19 KB
/
polite-hwclock-hctosys.systemv
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
#!/bin/bash
### BEGIN INIT INFO
# Provides: polite-hwclock-hctosys
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Polite hwclock sync
# Description: Politely set the system clock from the hardware clock
PID_FILE_NAME=/var/run/polite-hwclock-hctosys.pid
start() {
if [[ -f "$PID_FILE_NAME" ]]; then
echo "start: already running"
exit 1
else
/usr/local/bin/polite-hwclock-hctosys systemv
echo "start: started"
fi
}
stop() {
if [[ -f "$PID_FILE_NAME" ]]; then
pid=$(cat "$PID_FILE_NAME")
kill $(cat "$PID_FILE_NAME")
echo "stop: stopped"
else
echo "stop: not running"
fi
}
status() {
if [[ -f "$PID_FILE_NAME" ]]; then
pid=$(cat "$PID_FILE_NAME")
echo "Running, pid is $pid"
else
echo "Not running"
fi
}
### main logic ###
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status
;;
restart|reload|condrestart)
stop
start
;;
*)
echo "Usage: $0 {start|stop|restart|reload|status}"
exit 1
esac
exit 0