0

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?

3 Answers 3

2
  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!
1

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

1

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.

You must log in to answer this question.

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