diff --git a/Makefile.am b/Makefile.am index 65bf402..a1a625d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -15,6 +15,7 @@ EXTRA_DIST = \ sample-etc_dhclient-exit-hooks \ sample-etc_dhcpc_dhcpcd-eth0.exe \ sample-etc_ppp_ip-up.local \ + sample-etc_rc.d_ddclient.freebsd \ sample-etc_rc.d_init.d_ddclient \ sample-etc_rc.d_init.d_ddclient.alpine \ sample-etc_rc.d_init.d_ddclient.lsb \ diff --git a/README.md b/README.md index df5fe6b..2809018 100644 --- a/README.md +++ b/README.md @@ -141,7 +141,7 @@ make sure you have perl and the required modules installed if you plan to use cloudflare or feedns you need the perl json module - apt-get install libjson-any-perl + apt-get install libjson-pp-perl for IPv6 you also need to instal the perl io-socker-inet6 module @@ -151,6 +151,28 @@ start the first time by hand service ddclient start +### FreeBSD style rc files and daemon mode + + mkdir -p /usr/local/etc/rc.d + cp sample-etc_rc.d_ddclient.freebsd /usr/local/etc/rc.d/ddclient + +enable automatic startup when booting + + sysrc ddclient_enable=YES + +make sure you have perl and the required modules installed + + pkg install perl5 p5-Data-Validate-IP p5-IO-Socket-SSL + +if you plan to use cloudflare or feedns you need the perl json module + + pkg install p5-JSON-PP + +start the service manually for the first time + + service ddclient start + + If you are not using daemon-mode, configure cron and dhcp or ppp as described below. ------------------------------------------------------------------------------- diff --git a/sample-etc_rc.d_ddclient.freebsd b/sample-etc_rc.d_ddclient.freebsd new file mode 100755 index 0000000..d8dc341 --- /dev/null +++ b/sample-etc_rc.d_ddclient.freebsd @@ -0,0 +1,31 @@ +#!/bin/sh + +# PROVIDE: ddclient +# REQUIRE: LOGIN +# KEYWORD: shutdown +# +# Add the following lines to /etc/rc.conf.local or /etc/rc.conf +# to enable this service: +# +# ddclient_enable (bool): Set to NO by default. +# Set it to YES to enable ddclient. + +. /etc/rc.subr + +name=ddclient +rcvar=ddclient_enable +ddclient_conf="/etc/ddclient/ddclient.conf" + +command="/usr/local/sbin/${name}" +load_rc_config $name + +delay=$(grep -v '^\s*#' "${ddclient_conf}" | grep -i -m 1 "daemon" | awk -F '=' '{print $2}') + +if [ -z "${delay}" ] +then + ddclient_flags="-daemon 300" +else + ddclient_flags="" +fi + +run_rc_command "$1"