2016-08-23 6 views
1

Wie wird Crontab festgelegt, wenn AWS CloudFormation-Benutzerdaten verwendet werden?Crontab in AWS CloudFormation Benutzerdaten

Ich gründe

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

Aber die cron Einstellung nicht. Gibt es ein bestimmtes Format, das ich verwenden sollte?

Antwort

2

Dies funktioniert, setzen Sie diese in Ihrer Vorlage, für die Instanz:

"UserData": { 
    "Fn::Base64": { 
     "Fn::Join": [ 
      "", 
      [ 
       "#!/bin/bash\n", 
       "echo '0 * * * * wget -O - -q http://www.example.com/cron.php' > /tmp/mycrontab.txt\n", 
       "sudo -u ubuntu bash -c 'crontab /tmp/mycrontab.txt'\n", 
      ] 
     ] 
    } 
} 
Verwandte Themen