简体   繁体   中英

startup scripts for amazon linux ami


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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM