mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-11-24 05:55:43 +03:00
+ OpenRC service-script
parent
35327c3ef3
commit
5e15833ff3
2 changed files with 63 additions and 1 deletions
1
Home.md
1
Home.md
|
@ -30,3 +30,4 @@ The wiki was just recently created, so there isn't much content (yet).
|
|||
* [AdGuard Home as a DNS-over-HTTPS or DNS-over-TLS server](Encryption)
|
||||
* [How to install and run AdGuard Home on Raspberry Pi](Raspberry-Pi)
|
||||
* [How to install and run AdGuard Home on a Virtual Private Server](VPS)
|
||||
* [OpenRC service-script](OpenRC)
|
||||
|
|
61
OpenRC.md
Normal file
61
OpenRC.md
Normal file
|
@ -0,0 +1,61 @@
|
|||
# OpenRC service-script
|
||||
|
||||
A service-script for OpenRC-based systems, for example if you run AdGuard Home in Alpine (without using Docker).
|
||||
|
||||
## Installation
|
||||
|
||||
Install OpenRC:
|
||||
|
||||
apk update
|
||||
apk add openrc
|
||||
|
||||
Then copy the script below to /etc/init.d/adguardhome
|
||||
|
||||
#!/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 $?
|
||||
}
|
||||
|
||||
## Usage
|
||||
|
||||
Enable running AdGuard Home on boot:
|
||||
|
||||
rc-update add adguardhome
|
||||
|
||||
Controlling AdGuard Home:
|
||||
|
||||
service adguardhome <start|stop|restart|status|checkconfig>
|
Loading…
Reference in a new issue