During the installation on AWS Elastic Beanstalk, I want to do two things:
- Take the cron entry file and put this file in /etc/cron.d/
- Change the file permissions on shell scripts contained in the same directory so that they can be run by cron
In my .ebextensions folder, I have the following:
container_commands: 00fix_script_permissions: command: "chmod u+x /var/app/current/scripts/*" 01setup_cron: command: "cat .ebextensions/propel_mis_crons.txt > /etc/cron.d/propel_mis_crons && chmod 644 /etc/cron.d/propel_mis_crons" leader_only: true
And the propel_mis_crons.txt file in the .ebextensions folder has:
# mh dom mon dow command MAILTO=" dev@23sparks.com " * * * * * root /var/app/current/scripts/current_time.sh
I checked the deployment logs and I see the following:
2013-08-09 14:27:13,633 [DEBUG] Running command 00fix_permissions_dirs 2013-08-09 14:27:13,633 [DEBUG] Generating defaults for command 00fix_permissions_dirs <<< 2013-08-09 14:27:13,736 [DEBUG] No test for command 00fix_permissions_dirs 2013-08-09 14:27:13,752 [INFO] Command 00fix_permissions_dirs succeeded 2013-08-09 14:27:13,753 [DEBUG] Command 00fix_permissions_dirs output: 2013-08-09 14:27:13,753 [DEBUG] Running command 01setup_cron 2013-08-09 14:27:13,753 [DEBUG] Generating defaults for command 01setup_cron <<< 2013-08-09 14:27:13,829 [DEBUG] Running test for command 01setup_cron 2013-08-09 14:27:13,846 [DEBUG] Test command output: 2013-08-09 14:27:13,847 [DEBUG] Test for command 01setup_cron passed 2013-08-09 14:27:13,871 [INFO] Command 01setup_cron succeeded 2013-08-09 14:27:13,872 [DEBUG] Command 01setup_cron output:
However, when deploying, permissions for all files in the script directory are set incorrectly, and cron does not start. I'm not sure cron is not working due to permission problems or if something else prevents this. This runs on a 64-bit instance of Amazon Linux in PHP5.4.
Thank you for your help. It is possible that over time, new shell scripts will be added that will be launched by cron.