Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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/dev_appserver.sh --port=8080 appengine-java-sdk-1.6.4/demos/VosaoCMS/war

How would I do that?

share|improve this question

3 Answers 3

  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/script.sh

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

 
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.