aboutsummaryrefslogtreecommitdiff
path: root/network/AdGuardHome/rc.AdGuardHome
diff options
context:
space:
mode:
authorAlexander Verbovetsky <alik@ejik.org>2019-10-26 22:09:30 +0700
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2019-10-26 22:09:30 +0700
commit54a6edba5beb4763124b6705971dab8f0aef76e5 (patch)
tree3f3c43ebfb473894055db4470181c8bb04ae8986 /network/AdGuardHome/rc.AdGuardHome
parentd9abd80e0184668f531ea3093979f611f8cc8998 (diff)
network/AdGuardHome: Added (Ad blocking DNS server).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'network/AdGuardHome/rc.AdGuardHome')
-rw-r--r--network/AdGuardHome/rc.AdGuardHome54
1 files changed, 54 insertions, 0 deletions
diff --git a/network/AdGuardHome/rc.AdGuardHome b/network/AdGuardHome/rc.AdGuardHome
new file mode 100644
index 0000000000000..23832689d130c
--- /dev/null
+++ b/network/AdGuardHome/rc.AdGuardHome
@@ -0,0 +1,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