0

I am adding startup script in Ubuntu with update-rc.d.
My script says :

  #!/bin/bash

nohup curl -C - -o ~/Downloads/linuxmint-17-xfce-dvd-64bit.iso.part 'http://mirror.umd.edu/linuxmint/images/stable/17/linuxmint-17-xfce-dvd-64bit.iso'  
exit

Made it executable and added in /etc/init.d

Now when I run the script manually, it runs absolutely fine.

But after adding in startup, it does not start automatically.
It throws me with an error in nohup.out as below :

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (7) Couldn't connect to server

Is there anything more I need to check or what else option I can use to run the same script on startup.

root@amol-Lenovo-G570:~# ll /etc/rc2.d/ total 20 
drwxr-xr-x 2 root root 4096 Nov 7 20:24 ./ 
drwxr-xr-x 179 root root 12288 Nov 7 19:36 ../ 
lrwxrwxrwx 1 root root 32 Oct 23 12:38 K08vmware-USBArbitrator -> /etc/init.d/vmware-USBArbitrator* 
lrwxrwxrwx 1 root root 20 Sep 26 2012 S19postgresql -> ../init.d/postgresql*   
lrwxrwxrwx 1 root root 21 Nov 7 20:24 S20download.sh -> ../init.d/download.sh* 

where download.sh is the script I am running.

3
  • 1
    it look like your are trying to fetch before network layer is up. can you list /etc/rc2.d ? (or rcX.d where X is you run-level ? )
    – Archemar
    Commented Nov 7, 2014 at 14:50
  • root@amol-Lenovo-G570:~# ll /etc/rc2.d/ total 20 drwxr-xr-x 2 root root 4096 Nov 7 20:24 ./ drwxr-xr-x 179 root root 12288 Nov 7 19:36 ../ lrwxrwxrwx 1 root root 32 Oct 23 12:38 K08vmware-USBArbitrator -> /etc/init.d/vmware-USBArbitrator* lrwxrwxrwx 1 root root 20 Sep 26 2012 S19postgresql -> ../init.d/postgresql* lrwxrwxrwx 1 root root 21 Nov 7 20:24 S20download.sh -> ../init.d/download.sh* where download.sh is the script I am running.
    – amolveer
    Commented Nov 7, 2014 at 15:01
  • Couldn't connect to server Your internet isn't working? Commented Nov 7, 2014 at 15:44

2 Answers 2

1

The problem is simple. Your network isn't even up so:

Couldn't connect to server

I would create a upstart/systemd or a real sysv-init script with dependencies to the network.

There are several ways you can accomplish this:

0

Just add a --retry 5 --retry-max-time 120 and it'll eventually work just fine.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .