NoIP

Telepítés

Program fájl telepítése:

Indító script telepítése (/etc/init.d/noip2):

#!/bin/bash ### BEGIN INIT INFO # Provides: noip2 # Required-Start: # Required-Stop: # Should-Start: $network $syslog # Should-Stop: $network $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start and stop noip2 # Description: noip2 manages dyn dns ### END INIT INFO . /lib/lsb/init-functions set -euf -o pipefail NOIP_BIN='/usr/local/bin/noip2' NOIP_NAME='noip2' NOIP_OPTIONS="${NOIP_OPTIONS:-}" function do_start() { local rc=0 log_daemon_msg 'Starting dynamic DNS client...' "${NOIP_BIN}" ${NOIP_OPTIONS} || rc=$? log_end_msg "${rc}" return ${rc} } function do_stop() { local rc=0 local pid="$(get_pid)" if [ -z "${pid}" ]; then log_warning_msg "${NOIP_NAME} not running" return fi log_daemon_msg 'Stopping dynamic DNS client...' "${NOIP_BIN}" -K "${pid}" \ && waiting_for_stop "${pid}" \ || rc=$? log_end_msg "${rc}" return ${rc} } function get_pid() { "${NOIP_BIN}" -S 2>&1 \ | grep '^Process' \ | sed -E 's>^Process ([0-9]+),.+$>\1>' \ || true } function waiting_for_stop() { local pid="$1" local waiting_cycles=10 while kill -0 ${pid} 2>/dev/null; do waiting_cycles="$[${waiting_cycles} - 1]" if [ "${waiting_cycles}" -lt 1 ]; then log_failure_msg "failed to stop ${NOIP_NAME} daemon" return 1 fi sleep 0.5 done } case "$1" in start) do_start ;; stop) do_stop ;; restart) do_stop do_start ;; *) echo "Usage: $0 {start|stop|restart}" exit 1 esac exit 0
chmod +x /etc/init.d/noip2

Automatikus indítás és leállítás bekötése:

update-rc.d noip2 defaults

Automatikus címfrissítés PPPoE kapcsolat esetén

Wrapper script beállítása (/etc/ppp/ip-up.d/noip2):

#!/bin/bash # # ip-up script for noip2 # Some useful variables, as noted at # http://www.tldp.org/HOWTO/PPP-HOWTO/x1455.html # # $1 the interface name used by pppd (e.g. ppp3) # $2 the tty device name # $3 the tty device speed # $4 the local IP address for the interface # $5 the remote IP address # $6 the parameter specified by the 'ipparam' option to pppd # Restart noip2 daemon NOIP_OPTIONS="-I $1" /etc/init.d/noip2 restart
chmod +x /etc/ppp/ip-up.d/noip2