I'm want to execute the script once the machine is up and running. Basically running "groovy /scripts/myscript.groovy".

No need for it to be a service or to re-run the script in case it's stopped!

2 questions:

  • Where should I put that call? rc.local? init.d? excuse my ubuntu (lack of) skills.
  • Is there a way I can test it other than restarting the machine? (Amazon EC2)



lYou right, you have to create a new line on rc.local or create a script (start/stop/restart/status) in /etc/init.d/myscript.

Ex on rc.local call :

#!/bin/sh -e
# rc.local
# ....
/path/to/groovy /path/to/your/scripts/myscript.groovy
exit 0

And about boot, you can have all informations on /var/log/boot.log on each boot. On try uptime to test the uptime of your server. Or add one more rc.local line to call a script who warn you by mail if the server boot, etc. There is many possibilities, depending of your needs.

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.