Crontab in AWS CloudFormation Userdata

后端 未结 3 946
春和景丽
春和景丽 2021-02-10 13:21

How to set crontab when using AWS CloudFormation Userdata?

I am setting

(crontab -l ; echo \"0 * * * * wget -O - -q http://www.example.com/cron.php\") |          


        
3条回答
  •  无人共我
    2021-02-10 13:34

    To do this properly you should do the following inside the bash script:

    crontab -l > /tmp/mycrontab
    echo '0 * * * * wget -O - -q http://www.example.com/cron.php' >> /tmp/mycrontab
    crontab /tmp/mycrontab
    

提交回复
热议问题