Friday, January 20, 2012

run noip duc automatically when debian is booted

sudo cp noip-duc-linux/noip-2.1.9-1/debian.noip2.sh /etc/init.d/noip2
sudo chown root:root /etc/init.d/noip2
sudo chmod 755 /etc/init.d/noip2

according to http://wiki.debian.org/LSBInitScripts/DependencyBasedBoot
instead of
update-rc.d noip2 defaults

add "INIT INFO" to /etc/init.d/noip2

### BEGIN INIT INFO
# Provides: noip2
# Required-Start:
# Required-Stop:
# Should-Start:
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start and stop directadmin
# Description: DirectAdmin
### END INIT INFO

then
sudo insserv noip2
(with out the INIT INFO, the error "insserv: warning: script 'X' missing LSB tags and overrides"  will be shown.)

the whole file will be

#! /bin/sh
# /etc/init.d/noip2.sh

# Supplied by no-ip.com
# Modified for Debian GNU/Linux by Eivind L. Rygge
# corrected 1-17-2004 by Alex Docauer

# . /etc/rc.d/init.d/functions  # uncomment/modify for your killproc

### BEGIN INIT INFO
# Provides: noip2
# Required-Start:
# Required-Stop:
# Should-Start:
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start and stop directadmin
# Description: DirectAdmin
### END INIT INFO

exec >> /tmp/debug-my-script.txt 2>&1
echo $1


DAEMON=/usr/local/bin/noip2
NAME=noip2

test -x $DAEMON || exit 0

case "$1" in
    start)
        echo -n "Starting dynamic address update: "
        start-stop-daemon --start --exec $DAEMON
        echo "noip2."
        ;;
    stop)
        echo -n "Shutting down dynamic address update:"
        start-stop-daemon --stop --oknodo --retry 30 --exec $DAEMON
        echo "noip2."
        ;;
    restart)
        echo -n "Restarting dynamic address update: "
        start-stop-daemon --stop --oknodo --retry 30 --exec $DAEMON
        start-stop-daemon --start --exec $DAEMON
        echo "noip2."
        ;;
   status)
        echo "noip2."
            ;;
    *)
        echo "Usage: $0 {start|stop|restart}"
        exit 1
esac
exit 0
when disable noip2 type
sudo insserv -r noip2

2 comments:

  1. I have edited the noip2 to match yours ran the second and third lines chown and chmod and when I run insserv noip2 I keep getting errors
    insserv: warning: current start runlevel(s) (empty) of script `noip2' overwrites defaults ( 2 3 4 5).
    insserv: warning: current stop runlevel(s) (0) of script `noip2' overwrites defaults (0 1 6 ).
    Any ideas what could be going wrong running Debian 6.04

    ReplyDelete
  2. THANK YOU! I have been struggling with all night.

    ReplyDelete