Introduction: Hello! We encountered an issue while attempting to install crontab on Amazon Linux 2023 EC2 instances. Unfortunately, crontab is not available by default in these instances. This blog post will delve into the issue and provide a step-by-step workaround to successfully install crontab on Amazon Linux 2023 EC2 instances.
Issue: During our investigation, we found that the ‘cronie’ package is intentionally not included in the Amazon Linux 2023 AMIs, as the same functionality, and even better, is provided by ‘systemd’. You can refer to the following issue opened with the Amazon Linux 2023 team: [https://github.com/amazonlinux/amazon-linux-2023/issues/300]
Workaround: In the meantime, installing the ‘cronie’ package as follows:
Step 1: Install the ‘cronie’ package.
sudo yum install cronie -y
Step 2: Enable the ‘cronie’ service.
sudo systemctl enable crond.service
Step 3: Start the ‘cronie’ service.
sudo systemctl start crond.service
The status of the ‘cronie’ service should now reflect as ‘active’:
sudo systemctl status crond | grep Active
Active: active (running) since Tue 2023-04-11 16:47:06 UTC; 18s ago
Hence, you can consider installing ‘cronie’ manually on your instances as it is available in the Amazon Linux 2023 repository. Once installed, you can set up cron jobs as usual.
(Optional) To verify the status of ‘cronie’:
sudo systemctl status crond.service
You can refer to the following third-party article for more information on setting up cron jobs: [https://www.freecodecamp.org/news/cron-jobs-in-linux/]
In case you face any issues while setting up cron jobs, please feel free to share the outputs of errors and logs available at /var/log/cron.
Thank you for reading, and stay tuned for further updates on this issue!
Note: Due to inactivity, there might be some delay in response.