Installing CronTab on Amazon Linux 2023 EC2

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.

--

--

๐’๐š๐ค๐ž๐ญ ๐‰๐š๐ข๐ง

๐ƒ๐ž๐ฏ๐Ž๐ฉ๐ฌ/๐’๐‘๐„/๐‚๐ฅ๐จ๐ฎ๐ /๐ˆ๐ง๐Ÿ๐ซ๐š๐ฌ๐ญ๐ซ๐ฎ๐œ๐ญ๐ฎ๐ซ๐ž /๐’๐ฒ๐ฌ๐ญ๐ž๐ฆ ๐„๐ง๐ ๐ข๐ง๐ž๐ž๐ซ