forked from haris2887/Adguardd-Proxomx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAdguardHome
53 lines (43 loc) · 1.02 KB
/
AdguardHome
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
#!/sbin/openrc-run
#
# openrc service-script for AdGuardHome
#
# place in /etc/init.d/
# start on boot: "rc-update add AdGuardHome"
# control service: "service AdGuardHome <start|stop|restart|status|checkconfig>"
#
description="AdGuard Home: Network-level blocker"
pidfile="/run/$RC_SVCNAME.pid"
command="/opt/AdGuardHome/AdGuardHome"
command_args="-s run"
command_background=true
extra_commands="checkconfig"
depend() {
need net
provide dns
after firewall
}
checkconfig() {
"$command" --check-config || return 1
}
stop() {
if [ "${RC_CMD}" = "restart" ] ; then
checkconfig || return 1
fi
ebegin "Stopping $RC_SVCNAME"
start-stop-daemon --stop --exec "$command" \
--pidfile "$pidfile" --quiet
eend $?
}
start() {
checkconfig || return 1
ebegin "Starting $RC_SVCNAME"
start-stop-daemon --start --exec "$command"
--pidfile "$pidfile" --quiet --background
eend $?
while ! pgrep -f "$command" > /dev/null; do
sleep 1
start-stop-daemon --start --exec "$command"
--pidfile "$pidfile" --quiet --background
done
}