blob: 23832689d130c8d26d561beaf36b1a28487e8167 (
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
|
#!/bin/sh
# Start/stop/restart the AdGuard Home
bin=/usr/sbin/AdGuardHome
config=/etc/AdGuardHome.yaml
workdir=/var/lib/AdGuardHome
pidfile=/var/run/AdGuardHome.pid
start_AdGuardHome() {
echo "Starting AdGuard Home... "
if [ -f $pidfile ]; then
echo "AdGuard Home is already running with PID $(cat ${pidfile})."
exit 0
fi
nohup $bin --config $config --work-dir $workdir --no-check-update \
--pidfile $pidfile 0<&- &>/dev/null &
}
stop_AdGuardHome() {
echo "Stoppping AdGuard Home... "
[ -f $pidfile ] && kill $(cat ${pidfile})
}
restart_AdGuardHome() {
stop_AdGuardHome
sleep 1
start_AdGuardHome
}
status_AdGuardHome() {
if [ -f $pidfile ]; then
echo "AdGuard Home is running with PID $(cat ${pidfile})."
else
echo "AdGuard Home is stopped."
exit 1
fi
}
case "$1" in
'start')
start_AdGuardHome
;;
'stop')
stop_AdGuardHome
;;
'restart')
restart_AdGuardHome
;;
'status')
status_AdGuardHome
;;
*)
echo "usage $0 start|stop|restart|status"
esac
|