Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
add comment

1 Answer

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
add comment

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.