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
/etc/rc.d/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?

link|improve this question
feedback

1 Answer

up vote 3 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.

link|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: askubuntu.com/a/20347/3940 – Takkat Dec 18 '11 at 8:31
1  
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
show 1 more comment
feedback

Your Answer

 
or
required, but never shown

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