Added Alpine Linux init script

This commit is contained in:
Tal 2014-03-10 21:04:31 -06:00
parent 89153c20e7
commit 056fab5531
4 changed files with 49 additions and 0 deletions

View file

@ -59,6 +59,14 @@ INSTALLATION:
## start the first time by hand
/etc/rc.d/init.d/ddclient start
## For those using Alpine style rc files and using daemon-mode:
cp sample-etc_rc.d_init.d_ddclient.alpine /etc/init.d/ddclient
chmod 755 /etc/init.d/ddclient
## enable automatic startup when booting
rc-update add ddclient
## start the first time by hand
rc-service ddclient start
## If you are not using daemon-mode, configure cron and dhcp or ppp
## as described below.

View file

@ -6,5 +6,7 @@ you have IO::Socket::SSL.
On debian, you need libio-socket-ssl-perl to have IO::Socket::SSL
On alpine, you need perl-io-socket-ssl to have IO::Socket::SSL
ssl support is tested on folowing dynamic dns providers:
- dyndns.com

View file

@ -1784,6 +1784,7 @@ sub load_ssl_support {
Error loading the Perl module IO::Socket::SSL needed for SSL connect.
On Debian, the package libio-socket-ssl-perl must be installed.
On Red Hat, the package perl-IO-Socket-SSL must be installed.
On Alpine, the package perl-io-socket-ssl must be installed.
EOM
}
import IO::Socket::SSL;

View file

@ -0,0 +1,38 @@
#!/sbin/runscript
description="ddclient Daemon for Alpine"
command="/usr/sbin/ddclient"
config_file="/etc/ddclient/ddclient.conf"
command_args=""
pidfile=$(grep -v '^\s*#' "${config_file}" | grep -i -m 1 pid= | awk -F '=' '{print $2}')
delay=$(grep -v '^\s*#' "${config_file}" | grep -i -m 1 "daemon" | awk -F '=' '{print $2}')
if [ -z "${delay}" ]
then
command_args="-daemon 300"
else
command_args=""
fi
depend() {
use logger
need net
after firewall
}
start() {
ebegin "Starting ddclient"
start-stop-daemon --start \
--exec "${command}" \
--pidfile "${pidfile}" \
-- \
${command_args}
eend $?
}
stop() {
ebegin "Stopping ddclient"
start-stop-daemon --stop --exec "${command}" \
--pidfile "${pidfile}"
eend $?
}