AWS Elastic Beanstalk, running a cronjob

This is how I added a cron job to Elastic Beanstalk: Create a folder at the root of your application called .ebextensions if it doesn’t exist already. Then create a config file inside the .ebextensions folder. I’ll use example.config for illustration purposes. Then add this to example.config container_commands: 01_some_cron_job: command: “cat .ebextensions/some_cron_job.txt > /etc/cron.d/some_cron_job && … Read more

Use PHP to create, edit and delete crontab jobs?

crontab command usage usage: crontab [-u user] file crontab [-u user] [ -e | -l | -r ] (default operation is replace, per 1003.2) -e (edit user’s crontab) -l (list user’s crontab) -r (delete user’s crontab) -i (prompt before deleting user’s crontab) So, $output = shell_exec(‘crontab -l’); file_put_contents(‘/tmp/crontab.txt’, $output.’* * * * * NEW_CRON’.PHP_EOL); echo … Read more