Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have just installed No-IP on a brand new Ubuntu 12.04 install. The program starts fine when I start it from the CLI, but if I try to make this startup script work it won't start.

I got this script from their install instructions:

#! /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."
    killall -TERM /usr/local/bin/noip2
    ;;
    *)
    echo "Usage: $0 {start|stop}"
    exit 1
esac
exit 0

The CL is correct because if I run /usr/local/bin/noip2 it starts. But the script itself won't start it.

What do I have wrong in there? The script is executable:

-rwxrwxrwx   1 root root   299 Jan 12 13:28 noip*

EDIT

If I try the Init.d script it also works:

sudo /etc/init.d/noip start

It starts up just fine that way without a hitch.

share|improve this question
up vote 7 down vote accepted

You should run this (if you have not done so):

sudo update-rc.d noip2 defaults
share|improve this answer

and I had to add the line above but with root as user and now it works fine for me.

@reboot    root  /usr/local/bin/noip2

to edit crontab

sudo nano /etc/crontab
share|improve this answer

In addition to the:

 sudo update-rc.d noip2 defaults

you should also set permissions of:

chmod 755 /etc/init.d/noip

Then you should be able to start and stop. tested on Ubuntu 14.04 LTS

following these directions from:
How To Install No-ip2 On Ubuntu 12.04 LTS In Order To Host Servers On A Dynamic IP Address

share|improve this answer
    
Then need to go to chmod 700 per those instructions in the link so only root can run it. – daveferrara1 Dec 6 '14 at 16:54

It's very easy, I created a line in root crontab:

@reboot /usr/local/bin/noip2

When i power on or reboot my machine, the daemon starts automatically

share|improve this answer
    
I tried this, and the process is there when it boots, but the IP is not updated, why??? – knocte Nov 5 '15 at 15:40
    
ok, I guess what was happening is that it was running the command before launching the network interface, so if you do sleep 30 && /usr/local/bin/noip2 it will work. Therefore I'm upvoting this for being the simplest solution of all, no need to tinker with init.d scripts! – knocte Nov 5 '15 at 15:48
1  
javier and @knocte thanks! This works great! Very easy and no need to mess with init.d scripts. It should be noted that you need to specify the full path of noip2 in the crontab file (sudo crontab -e) as simply specifying sleep 30 && noip2 won't work. – ADTC Jan 2 at 8:10

Do you symlink to the /etc/init.d script from any /etc/rc?.d directory? I have

/etc/rc0.d/K10no-ip.com -> ../init.d/no-ip.com.sh*
/etc/rc1.d/K10no-ip.com -> ../init.d/no-ip.com.sh*
/etc/rc2.d/S90no-ip.com -> ../init.d/no-ip.com.sh*
/etc/rc3.d/S90no-ip.com -> ../init.d/no-ip.com.sh*
/etc/rc4.d/S90no-ip.com -> ../init.d/no-ip.com.sh*
/etc/rc5.d/S90no-ip.com -> ../init.d/no-ip.com.sh*
/etc/rc6.d/K10no-ip.com -> ../init.d/no-ip.com.sh*
share|improve this answer
3  
That is what update-rc.d is for. :) – gertvdijk Jan 23 '13 at 0:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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