Super User is a question and answer site for computer enthusiasts and power users. 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'm using Ubuntu 11.10 and I've to execute a shell commands at the startup.

java -jar selenium....

I tried with this but nothing:

sudo gedit /etc/init.d/nomescript.sh 
sudo chmod a+x /etc/init.d/nomescript.sh
sudo update-rc.d nomescript.sh defaults

Do you know how I can do this?

Thank you!! Marco

share|improve this question
    
If programs in your script depend on other resources being up and running, you need to specify priorities in your update-rc.d command. – RedGrittyBrick Apr 18 '12 at 14:20
up vote 0 down vote accepted

Ubuntu has abandoned SysV init script approach to booting the system.

This link explains how to create an Upstart script and how to run it at boot - http://www.linuxplanet.com/linuxplanet/tutorials/7033/1/

share|improve this answer
    
Ok, it works.. Thanks!! – Mark Design Apr 23 '12 at 10:34
    
You're welcome. – bryan Apr 23 '12 at 14:20
    
I don't understand a thing: if I execute the shell command at the startup it works but selenium gives me an error, if I execute the same command in the terminal all works.. – Mark Design May 2 '12 at 8:09

You could add a line to your crontab:

@reboot command here

That pretty much guarantees it won't happen more than once (like /etc/rc.local or gnome sessions) It also lets you ensure it is run as the correct user very easily.

share|improve this answer

You must log in to answer this question.

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