Tell me more ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a script that I would like to run when my system starts. I have put it on "rc.local", but it doesn't work. How can I enable it to run on startup?

Thanks!

share|improve this question
Where is the xsetwacom command? /etc/rc.local is executed with a very simple PATH at startup. It probably differs from the PATH you have logged in at the terminal. In the terminal, type: type -p xsetwacom then replace the "xsetwacom" command in /etc/rc.local with the full path as returned by the "type -p". Do you have to do any manual initializations before xsetwacom works for you? – waltinator Sep 28 '11 at 22:09

3 Answers

up vote 6 down vote accepted

Can you run your script manually? If not, it's a problem with that script; otherwise look more at rc.local. (If that script needs to run as root, you need use sudo to manually run it.)

Make sure /etc/rc.local is executable and that the script it calls is also executable.

$ ls -l /etc/rc.local
-rwxr-xr-x 1 root root 419 2010-08-27 11:26 /etc/rc.local

Make sure rc.local has a shebang line (which is the default):

$ head -n1 /etc/rc.local
#!/bin/sh -e
share|improve this answer
Yes, I can run the script manually. How can I make sure /etc/rc.local is executable? What do I have to type? Is it "$ ls -l /etc/rc.local -rwxr-xr-x 1"? Thanks! – pedroo Oct 28 '10 at 8:47
@pedroo: I've copied exactly what I see in my terminal (so you see the prompt, input, and output all above). The command is "ls -l /etc/rc.local" and if it's executable, it will have those Xs in the output. – Roger Pate Oct 28 '10 at 8:50
I've tried the "ls -l /etc/rc.local" and it is executable, but I cannot make it run on startup... Any idea? – pedroo Oct 28 '10 at 23:49
@pedroo: What does this script do? Does it write to any log files that you need to check? (I think it's time to update the question with more details.) – Roger Pate Oct 28 '10 at 23:51
It's a xsetwacom command. When I run it in terminal, it works. But it doesn't run automatically when booting... – pedroo Oct 29 '10 at 0:02
show 7 more comments

2 suggestions.

  1. Ensure that the target script file is also marked executable.
  2. Is the target script running a sudo command? If so you might want to supply the sudo password to it.

My bad. Just check one then. Thanks for the correction enzotib :)

share|improve this answer
3  
rc.local is run as root, so no password is necessary. – enzotib Jun 29 '11 at 21:22

I have this problem for a while now... Updated from 12.04 to 12.10 and couple of days ago to 13.04 and the problem still persist. During all that time Google finds nothing usefull.

The script executes fine when run manually, but it wont execute at startup...

share|improve this answer

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.