3

I don't understant why my script is not running. Here is what I did (I'm using Ubuntu 10.04).

I wrote a mountFTP.conf script:

description     "Mount the remote FTP for sync"

start on started tty1

task
script
curlftpfs ftp://admin:[email protected] /FTP/
end script

I saved the script in /etc/init/ folder. If I use the command "service mountFTP start" it works, but it doesn't want to automatically start on boot...

I also tried with "strat on stratup" with no luck. I also added some log to the script to check if it is executed or not, and it is not executed at all.

3
  • Is tty1 started already? Try to place some logging in your script to see what happens...
    – Frantique
    Nov 15, 2012 at 14:18
  • I suppose you did type "start on startup" instead of "strat on stratup" ?
    – Nanne
    Nov 15, 2012 at 14:28
  • 1
    Probably that he did not linked the upstart-job to his script. See my answer.
    – Frantique
    Nov 15, 2012 at 14:33

2 Answers 2

2

Follow these steps:

sudo chown root:root yourscript.conf  
sudo chmod 644 yourscript.conf  
sudo mv yourscript.conf /etc/init  
cd /etc/init.d  
sudo ln -s /lib/init/upstart-job yourscript  
4
  • Thanks, I thought it would start after the tty1 service. So I tried with "start on runlevel [2345]" but it still wont start
    – lucas
    Nov 15, 2012 at 14:47
  • Yes it was "start on startup" in my script. I check the owner and permission on my script and it was already ok. I also tried to add the symlink in init.d but it doesn't help. Really strange
    – lucas
    Nov 15, 2012 at 15:04
  • 3
    Ok I finally found the solution! I used the following line in my script: "start on (local-filesystems and net-device-up IFACE=eth1)" I still don't know why the "start on runlevel [2345]" didn't worked.. Thanks Frantique for your help !
    – lucas
    Nov 15, 2012 at 15:40
  • I get an error: failed to create symbolic link /etc/init/mysript.conf file exists Jul 18, 2016 at 2:52
1

It looks like the version of Upstart that @Frantique mentions is only available in the latest (13.10) version of Ubuntu. Most of my stuff is older than that.

Another alternative is to pipe your output to 'logger'.

Try something like:

description     "Mount the remote FTP for sync"

start on started tty1

task
script
curlftpfs ftp://admin:[email protected] /FTP/ | logger
end script
3
  • I don't understand what this should solve. It doesn't work. Jul 18, 2016 at 2:55
  • 1
    The 'logger' command writes data received on STDIN to the syslog. You can verify that logger is installed by running 'which logger'. If it returns a path (like /usr/bin/logger), you have it. If not, you will need to install it. Jul 20, 2016 at 23:15
  • No point using a script block for a one-line command. Use exec instead.
    – Madbreaks
    May 14, 2018 at 19:49

You must log in to answer this question.

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