Using this tool -> inadyn 

apt-get install inadyn -y

Usage:

https://github.com/troglobit/inadyn#example-configuration

 

Suggested free DDNS providers: freedns.afraid.org, noip.com and etc..

 

auto-startup script as a service

knowledge from: http://www.linuxquestions.org/questions/linux-software-2/how-do-i-execute-inadyn-automatically-during-boot-541367/

And 

Init script for Inadyn

$~ mkdir /var/cache/inadyn

 

 

Edit this file:

/etc/inadyn.conf

 



this way

Code:
# Basic configuration file for inadyn
#
# /etc/inadyn.conf
#update_period_sec 600 # Check for a new IP every 600 seconds
background
verbose        1
period         300
cache-dir      /var/cache/inadyn
startup-delay  60
logfile /var/log/ddns.log
pidfile /var/run/ddns.pid


  

system default@freedns.afraid.org
ssl
username abcdefsafdsa
password fdadfferfsadf
alias oneofyour.donated.com
alias another.tooms.to

 

 

Now put this code in /etc/init.d/inadyn

Code:
#!/bin/bash
case "$1" in
    start)
    if [ -f /tmp/inadyn.pid ]; then
        PID=$(cat /tmp/inadyn.pid)
        kill -0 ${PID} &>/dev/null
        if [ $? = 0 ]; then
            echo "Inadyn is already running."
        else
            /usr/sbin/inadyn
            pidof inadyn > /tmp/inadyn.pid
            PID=$(cat /tmp/inadyn.pid)
            kill -0 ${PID} &>/dev/null
            if [ $? = 0 ]; then
                echo "Inadyn started succesfully."
            else
                echo "Error starting Inadyn"
            fi
        fi
    else
        /usr/sbin/inadyn
        pidof inadyn > /tmp/inadyn.pid
        PID=$(cat /tmp/inadyn.pid)
        kill -0 ${PID} &>/dev/null
        if [ $? = 0 ]; then
            echo "Inadyn started succesfully."
        else
            echo "Error starting Inadyn"
        fi
        fi
        ;;
    stop)
    if [ -f /tmp/inadyn.pid ];then
        PID=$(cat /tmp/inadyn.pid)
        kill -0 ${PID} &>/dev/null
        if [ $? = 0 ]; then
            /bin/kill ${PID}
            kill -0 ${PID} &>/dev/null
            if [ $? = 1 ]; then
                echo "Inadyn stopped succesfully."
            else
                echo "Error stopping Inadyn"
            fi
        else
            echo "Inadyn is already stopped."
        fi
    else
        echo "Inadyn is already stopped."
    fi
        ;;
    reload|restart)
        $0 stop
        $0 start
        ;;
    *)
        echo "Usage: $0 start|stop|restart|reload"
        exit 1
esac
exit 0

 

Then create these two links to start and stop service at system boot and shutdown:
ln -s /etc/init.d/inadyn /etc/rc2.d/S03inadyn
ln -s /etc/init.d/inadyn /etc/rc0.d/K03inadyn

 

相关文章:

  • 2021-06-26
  • 2022-12-23
  • 2021-05-30
  • 2021-12-10
  • 2021-07-27
  • 2021-11-15
  • 2021-04-11
  • 2021-06-11
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
  • 2021-07-29
  • 2022-12-23
  • 2021-06-03
  • 2021-08-19
相关资源
相似解决方案