-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdfscheck
executable file
·43 lines (36 loc) · 1.09 KB
/
dfscheck
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
#!/bin/sh /etc/rc.common
USE_PROCD=1 # Enable procd for service management
START=99
# Define the path to the dfscheck.sh script
DFSCHECK_SCRIPT="/root/dfscheck.sh"
# Define default values for channel, fallback_channel, and backoff_type
DEFAULT_CHANNEL=108
DEFAULT_FALLBACK_CHANNEL=149
DEFAULT_BACKOFF_TYPE="fixed"
start_service() {
logger -t "DFS-checker" "Starting dfscheck.sh"
procd_open_instance
procd_set_param command "$DFSCHECK_SCRIPT" "$DEFAULT_CHANNEL" "$DEFAULT_FALLBACK_CHANNEL" "$DEFAULT_BACKOFF_TYPE"
procd_set_param stdout 1 # Redirect stdout to log
procd_set_param stderr 1 # Redirect stderr to log
procd_set_param respawn # Automatically restart the service if it crashes
procd_close_instance
}
stop_service() {
logger -t "DFS-checker" "Stopping dfscheck.sh"
killall dfscheck.sh 2>/dev/null
}
restart() {
stop
start
}
status_service() {
local pid=$(pidof dfscheck.sh)
if [ -n "$pid" ]; then
echo "dfscheck.sh is running with PID $pid."
return 0
else
echo "dfscheck.sh is not running."
return 1
fi
}