Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

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 need to run a bash script at boot-time as superuser in Xubuntu. I don't know where to start. I have to do something described in a Arch Linux guide. That guide says exactly:

Add following at the end of the file : /etc/rc.sysinit

# Do my action

/bin/dmesg >| /var/log/dmesg.log

But I do not have /etc/rc.sysinit and /etc/rc.d/ in Xubuntu. I'm sure there are equivalent ones, right?

share|improve this question
up vote 7 down vote accepted

In Ubuntu (and I presume Xubuntu), the file you want is /etc/rc.local. This script will be run near or at the end of the boot process. Thus, everything should be up by this time.

However, as @bodhi.zazen pointed out, Upstart might be the best option for you. Check it out.

share|improve this answer
So, I've just to put that code here? For now, that file contains only exit 0. And if I can ask, on boot when rc.local is executed, is the filesystem ready so I can also write a log somewhere for that command I want to run? – lorenzo-s Dec 18 '11 at 2:27
It sounds as if you are trying to run a boot (init) script. Ubuntu uses upstart. rc.local will run a command, or series of commands on boot and may or may not be your best option. What are you trying to do exactly ? – bodhi.zazen Dec 18 '11 at 4:42
@lorenzo-s: See my edit. – Scott Severance Dec 18 '11 at 4:52
You may also find this answer helpful: – Takkat Dec 18 '11 at 8:31
Ok, I solved moving my_script from /usr/local/bin to /usr/bin. I'm also able to save log in /var/log using my_script &>> /var/log/my_script. Thank you very much. – lorenzo-s Dec 18 '11 at 12:45

Your Answer


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.