Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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've build a Play Framework Application (cool Java/Scala Web Framework) and would like to start it automatically like Apache2 or MySQL Server. For this I wrote a simple Bash script and did chmod +x on it, put it in /etc/init.d/ and it works fine when I call it manually in the shell. The Bash script is:

. /home/cc/Desktop/java/playmulti/playstart

This calls the following script:

(play start &)

The play start starts the Play Framework Application in /home/cc/Desktop/java/playmulti/. Also I did ls -s and tried to put in different /etc/rcX.d/ directories. I even used update-rc.d to put it there, but nothing I try seems to work. Script doesn't start with the reboot :/

Any suggestions are highly appreciated!

share|improve this question
Could you post the exact sequence of commands that you used? Specifically, how did you use update-rc.d? – Kalle Elmér Jan 18 '14 at 21:46
To start the script in "/home/cc/Desktop/java/playmulti/playstart" I did: "./playstart". To start "update-rc.d" I did "update-rc.d playmulti defaults" in the same directory. Is that what you meant? – Crayl Jan 18 '14 at 22:16
I should mention that I got the standard result from update-rc.d as shown here: – Crayl Jan 18 '14 at 22:24
Have you considered that during boot time you will only have a restricted environment set up? If your application framework requires e.g. a JAVA_HOME setting this may not be available yet. – Marcus Rickert Jan 18 '14 at 23:13
Well, one way to do this is is to source your bashrc script using the dot notation, e.g. . ~/.bashrc at the beginning of your script. The best way strongly depends on your specific setup. – Marcus Rickert Jan 19 '14 at 12:33
up vote 1 down vote accepted

I Think your sh file not geting its environment to run the scrip when start up you can do first go to your file path by


cd /home/cc/Desktop/java/playmulti java -cp your jar files along your full class path

share|improve this answer
That's correct! I had to "cd" into the folder and also to call the the full path for the "play" command, like "/folder/of/framework/play start". Thanks! – Crayl Jan 20 '14 at 13:01
you are well come – smn_onrocks Jan 22 '14 at 6:16

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.