Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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:

#!/bin/bash
. /home/cc/Desktop/java/playmulti/playstart

This calls the following script:

#!/bin/bash
(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
1  
Could you post the exact sequence of commands that you used? Specifically, how did you use update-rc.d? –  Kalle Elmér Jan 18 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 at 22:16
    
I should mention that I got the standard result from update-rc.d as shown here: debian-administration.org/articles/28 –  Crayl Jan 18 at 22:24
1  
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 at 23:13
2  
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 at 12:33

1 Answer 1

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

!/bin/bash

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 at 13:01
    
you are well come –  smn_onrocks Jan 22 at 6:16

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.