diff options
author | Alexander Verbovetsky <alik@ejik.org> | 2024-05-24 12:16:23 +0700 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2024-05-24 12:57:33 +0700 |
commit | 35ccc8b48d6600d85e579afdbc2ec97c271a0e3b (patch) | |
tree | 52162fadf4e44172b31d9f934335177ab7428bb0 /network/AdGuardHome/rc.AdGuardHome | |
parent | 0359ef33f1de973638d24e802b9586a0511d9e8a (diff) |
network/AdGuardHome: Updated for version 0.107.50.
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'network/AdGuardHome/rc.AdGuardHome')
-rw-r--r-- | network/AdGuardHome/rc.AdGuardHome | 46 |
1 files changed, 26 insertions, 20 deletions
diff --git a/network/AdGuardHome/rc.AdGuardHome b/network/AdGuardHome/rc.AdGuardHome index 73e09fdccb8f0..f5f5b0d9bfb99 100644 --- a/network/AdGuardHome/rc.AdGuardHome +++ b/network/AdGuardHome/rc.AdGuardHome @@ -1,25 +1,36 @@ #!/bin/bash # Start/stop/restart the AdGuard Home -bin=/usr/sbin/AdGuardHome -config=/etc/AdGuardHome.yaml -workdir=/var/lib/AdGuardHome -pidfile=/run/AdGuardHome.pid +name="AdGuardHome" +user="dnsproxy" +workdir=/var/lib/"$name" +pidfiles=/run/"$name" +mkdir -p $pidfiles +if /bin/id "$user" &>/dev/null; then + chown $user:$user $pidfiles + chown -R $user:$user $workdir + daemon="/usr/bin/daemon --name=$name --pidfiles=$pidfiles --user=$user" +else + daemon="/usr/bin/daemon --name=$name --pidfiles=$pidfiles" +fi start_AdGuardHome() { - echo "Starting AdGuard Home... " - if [ -f $pidfile ]; then - echo "AdGuard Home is already running with PID $(cat ${pidfile})." - exit 0 - fi - mkdir -p $workdir - nohup $bin --config $config --work-dir $workdir --no-check-update \ - --pidfile $pidfile 0<&- &>/dev/null & +if $daemon --running; then + echo "$name is already running" +else + echo "Starting $name..." + $daemon -- /usr/sbin/AdGuardHome --config /etc/AdGuardHome/AdGuardHome.yaml \ + --work-dir $workdir --no-check-update +fi } stop_AdGuardHome() { - echo "Stoppping AdGuard Home... " - [ -f $pidfile ] && kill $(cat ${pidfile}) +if $daemon --running; then + echo "Stopping $name..." + $daemon --stop +else + echo "$name is not running" +fi } restart_AdGuardHome() { @@ -29,12 +40,7 @@ restart_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 + $daemon --running --verbose } case "$1" in |