• DDNS client on a Linux machine


    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

    First of all you have to create (or edit) inadyn configuration file:

    $~ 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
     

    Then you can use:

    service inadyn start

  • 相关阅读:
    使用代码为textview设置drawableLeft
    Android Studio下添加assets目录
    lib32asound2 : Depends: libc6-i386 (>= 2.7) but it is not going to be installed
    android addJavascriptInterface 不能生效 解决办法
    [Android] 判断手机上是否安装了某个程序
    Github如何回退/回滚到某个版本
    Android导入第三方静态库.a编译成动态库.so
    (总结)Ubuntu apt-get apt-cache命令 使用
    C++11多线程std::thread的简单使用
    Android防止进程被第三方软件杀死
  • 原文地址:https://www.cnblogs.com/spaceship9/p/4818139.html
Copyright © 2020-2023  润新知