0

I create an instance automated with the AWS SDK and want some shell scripts to be executed by the box once it boots up the first time. BUT only on certain conditions, so I cant place this scripts in the crontab or init scripts.

Any ideas or experience with that ? Any other (or more generic) solutions than https://help.ubuntu.com/community/CloudInit ?

Thanks

javadude
  • 239
  • 2
  • 6
  • 14

1 Answers1

1

make a shell script that runs from /etc/init.d. after you run it first time create a file eg. /etc/i_run_my_script the script should look if that file exists and run according.

see User-Data Scripts from the docs - as well look at Upstart Job as well - basically you can combine them. you include in all instances the upstart job that looks for some file - then from your app you create the file based on your needs - every instance that has the file will execute the upstart job(init.d), the rest will not because the file is not there.

Chris S
  • 77,945
  • 11
  • 124
  • 216
silviud
  • 2,687
  • 2
  • 18
  • 19
  • need to have it optional. the instance would not know when, but the application that creates the instance. – javadude Jun 16 '11 at 03:11