Startup Applications – How to Run an Application on Startup Automatically

autorunbootserverstartupupstart

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 
####################################################### 

Best Answer

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.

Related Question