Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 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 ?


share|improve this question

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.

share|improve this answer
need to have it optional. the instance would not know when, but the application that creates the instance. – javadude Jun 16 '11 at 3:11

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.