0

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!

6
  • 1
    Could you post the exact sequence of commands that you used? Specifically, how did you use update-rc.d? Jan 18, 2014 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, 2014 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, 2014 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. Jan 18, 2014 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. Jan 19, 2014 at 12:33

1 Answer 1

1

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

2
  • 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, 2014 at 13:01
  • you are well come Jan 22, 2014 at 6:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.