6

I am using "UbuntuServer13.10" and I have Dynamic IP. So for learning purpose, I want to add a host on my dynamic IP to open my server easily from anywhere. For this purpose, I used www.noip.com script. Everything is working fine and its changing my Dynamic IP to there host automatically whenever my Dynamic IP got change. Now the problem is that for this purpose, I have to start the "No-IP" application on every boot manually that I don't want. I am using /usr/local/bin/noip2 in terminal to start manually after starting server. So my main question is that How to start this application on server startup/boot automatically? Waiting for perfect and easy solution...

I have the below script provided by "No-IP" support dept. Is this ok and where To Add This...

####################################################### 
#! /bin/sh 
# . /etc/rc.d/init.d/functions  # uncomment/modify for your killproc 
case "$1" in 
start) 
echo "Starting noip2." 
/usr/local/bin/noip2 
;; 
stop) 
echo -n "Shutting down noip2." 
killproc -TERM /usr/local/bin/noip2 
;; 
*) 
echo "Usage: $0 {start|stop}" 
exit 1 
esac 
exit 0 
####################################################### 

2 Answers 2

5

You should add your script to the runlevel defaults:

sudo touch /etc/init.d/noip2
sudo chmod 755 /etc/init.d/noip2
sudo update-rc.d noip2 defaults

Then add this into /etc/init.d/noip2

####################################################### 
#! /bin/sh 
# . /etc/rc.d/init.d/functions  # uncomment/modify for your killproc 
case "$1" in 
start) 
echo "Starting noip2." 
/usr/local/bin/noip2 
;; 
stop) 
echo -n "Shutting down noip2." 
killproc -TERM /usr/local/bin/noip2 
;; 
*) 
echo "Usage: $0 {start|stop}" 
exit 1 
esac 
exit 0 
####################################################### 

Then restart and your script will be running.

8
  • I tried your code and it run when I login to my user and got my host updated automatically without starting manually. But I want to run this "No-IP" on boot/start not after login to my user account. How to make it run automatically without login any account? Apr 2, 2014 at 7:28
  • See the updated answer
    – Danatela
    Apr 2, 2014 at 7:37
  • See my updated question. Is this the script that I have to add in rc.local instead of the above one that you provided. If yes, then after updating the new script provided by "No-IP" support, should I add this script to the runlevel defaults as you mentioned above? Apr 2, 2014 at 7:43
  • See the updated answer.
    – Danatela
    Apr 2, 2014 at 7:50
  • I did all as you said but still not getting the application on startup/boot. :( Apr 2, 2014 at 8:06
0

There is System-V link in linux which enables script execution on different startup level.

Follow below steps:

  1. make one shell script (which execute your application) eg.

    name start

    #!/bin/bash
    /bin/bash xxx.sh
    
  2. put this start to /etc/init.d/ directory

  3. now we need to put this script to start up level
  4. Run command update-rc.d start now restart you PC.

hope will help you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.