Server Fault is a question and answer site for system and network administrators. 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 am using Ubuntu 10.04 and I want to execute the following 3 statements when it starts:

export _JAVA_OPTIONS='-Xms32m -Xmx64m'

cd ~

appengine-java-sdk-1.6.4/bin/ --port=8080 appengine-java-sdk-1.6.4/demos/VosaoCMS/war

How would I do that?

share|improve this question
  1. Place your commands in a file and place the file in the /etc/init.d/ directory. For example, appengine-startup-script
  2. Make the script file executable. (E.g. chmod +x appengine-startup-script)
  3. Run update-rc.d [filename] defaults (E.g. update-rc.d appengine-startup-script defaults
  4. Enjoy!
share|improve this answer

You can also put an entry in your /etc/crontab whose runtime is set to @reboot. This will only fire the script off when your machine reboots.

Something like this:

@reboot /opt/Adrian/

share|improve this answer

Quick and dirty way would be to save those commands to a script (don't forget the shebang), make it executable, and then call the script on boot by placing the full path on a blank line at the end of /etc/rc.local.

This can get messy if you do it for a lot of different startup jobs, but for simple tasks rc.local is probably the quickest/easiest way to spawn a process on startup.

share|improve this answer

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.