I'm trying to start a script every time I start my amazon micro instance (amazon linux ami).
I tried to put it in /etc/init.d/ and linkted it to /etc/rc.d/ but the script is not executed.
I've also looked at user-data scripts, but as I understand the documentation they are only executed on the first startup of the instance.
What do I have to do to run my script on every startup?
Asked
Active
Viewed 2,244 times
1

AnonymFx
- 33
- 6
1 Answers
3
Init.d/rc.d are primarly used for services. Any scripts that you install here have to be enabled to run at boot chkconfig service on
.
Since it sounds like you are really just running a one time script. You can set it up to run with cron using the @reboot
flag instead of providing a time.

datasage
- 19,153
- 2
- 48
- 54