Hi All,
Thanks in advance for your help, as I am discovering FreeBSD.
I am trying to have AdGuardHome in a jail. Thanks to Thogs for the HowTo (https://forums.freebsd.org/threads/guide-how-to-install-adguardhome-on-freebsd.75496/).
My jail works, I have FreeBSD 12.3 and I successful installed AdGuardHome.
But I am trying to have a script which restarts AdGuardHome if it stops.
The HowTo proposes to create a service (I suppose as it) with a specific file: /etc/rc.d/adguardhome
The content is
What I observed before to implement the script:
- AdGuardHome is running and if there is a reboot, it is launched (rc.conf contains the relevant row for this)
- if I use : service adguardhome stop, the service is stopped (based on the code of adguarhome file in /etc/rc.d)
- and after stopping adguardhome, pgrep AdGuardHome shows a PID : so the daemon is always launched
How can I stop the service and the daemon ? I thought that both were linked.
Sure if I launch again the service adguardhome just after stopping it, I see with pgrep 2 PID numbers and not one
Thanks for your help, and pedagogic explanations
BR
Thanks in advance for your help, as I am discovering FreeBSD.
I am trying to have AdGuardHome in a jail. Thanks to Thogs for the HowTo (https://forums.freebsd.org/threads/guide-how-to-install-adguardhome-on-freebsd.75496/).
My jail works, I have FreeBSD 12.3 and I successful installed AdGuardHome.
But I am trying to have a script which restarts AdGuardHome if it stops.
The HowTo proposes to create a service (I suppose as it) with a specific file: /etc/rc.d/adguardhome
The content is
Code:
#!/bin/sh
. /etc/rc.subr
name="adguardhome"
rcvar="adguardhome_enable"
adguardhome_user="root"
adguardhome_command="/opt/AdGuardHome/AdGuardHome"
pidfile="/var/run/${name}.pid"
command="/usr/sbin/daemon"
command_args="-P ${pidfile} -r -f ${adguardhome_command}"
load_rc_config $name
: ${adguardhome_enable:=no}
run_rc_command "$1"[/ICODE]
I found a script for relaunching AdGuardHome but it seems that it scans the daemon:
[CODE]#!/bin/sh
SERVICE="AdGuardHome"
if
/usr/bin/pgrep -x "$SERVICE" >/dev/null
then
exit 0
#echo "$SERVICE is running"
else
nohup /AdGuardHome/AdGuardHome &
# mail
fi
What I observed before to implement the script:
- AdGuardHome is running and if there is a reboot, it is launched (rc.conf contains the relevant row for this)
- if I use : service adguardhome stop, the service is stopped (based on the code of adguarhome file in /etc/rc.d)
- and after stopping adguardhome, pgrep AdGuardHome shows a PID : so the daemon is always launched
How can I stop the service and the daemon ? I thought that both were linked.
Sure if I launch again the service adguardhome just after stopping it, I see with pgrep 2 PID numbers and not one
Thanks for your help, and pedagogic explanations
BR
Last edited by a moderator: