1 Answer
- Newest
- Most votes
- Most comments
1
Does the new version of Amazon Linux have the cron scheduler installed and running?
[ec2-user@ip-172-31-38-254 ~]$ sudo systemctl status crond
● crond.service - Command Scheduler
Loaded: loaded (/usr/lib/systemd/system/crond.service; enabled; preset: en>
Active: active (running) since Fri 2023-06-02 03:40:22 UTC; 2s ago
Main PID: 25539 (crond)
Rather surprisingly (to me anyway) the cron scheduler is not installed by default in Amazon Linux 2023, although it is a default in Amazon Linux 2.
[ec2-user@ip-172-31-46-115 ~]$ cat /etc/system-release
Amazon Linux release 2 (Karoo)
[ec2-user@ip-172-31-46-115 ~]$ ps -ef | grep cron
root 2339 1 0 03:32 ? 00:00:00 /usr/sbin/crond -n
ec2-user 2590 2548 0 03:34 pts/0 00:00:00 grep --color=auto cron
[ec2-user@ip-172-31-46-115 ~]$ rpm -qf /usr/sbin/crond
cronie-1.4.11-23.amzn2.x86_64
[ec2-user@ip-172-31-46-115 ~]$
[ec2-user@ip-172-31-38-254 ~]$ cat /etc/system-release
Amazon Linux release 2023 (Amazon Linux)
[ec2-user@ip-172-31-38-254 ~]$ ps -ef | grep cron
ec2-user 1762 1672 0 03:34 pts/0 00:00:00 grep --color=auto cron
[ec2-user@ip-172-31-38-254 ~]$ rpm -qa | grep cron
crontabs-1.11-24.20190603git.amzn2023.0.2.noarch
[ec2-user@ip-172-31-38-254 ~]$
If this is the same as you are seeing then you will need install it from the Amazon Linux 2023 repo, and once it's installed you need to start it (it will be enabled for restarting after susequent reboots).
[ec2-user@ip-172-31-38-254 ~]$ sudo yum install cronie -y
Last metadata expiration check: 0:07:19 ago on Fri Jun 2 03:32:34 2023.
Dependencies resolved.
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
cronie x86_64 1.5.7-1.amzn2023.0.2 amazonlinux 115 k
Installing dependencies:
cronie-anacron x86_64 1.5.7-1.amzn2023.0.2 amazonlinux 32 k
Transaction Summary
================================================================================
Install 2 Packages
.
.
.
Installed:
cronie-1.5.7-1.amzn2023.0.2.x86_64 cronie-anacron-1.5.7-1.amzn2023.0.2.x86_64
Complete!
[ec2-user@ip-172-31-38-254 ~]$ sudo systemctl start crond
[ec2-user@ip-172-31-38-254 ~]$ sudo systemctl status crond
● crond.service - Command Scheduler
Loaded: loaded (/usr/lib/systemd/system/crond.service; enabled; preset: en>
Active: active (running) since Fri 2023-06-02 03:40:22 UTC; 2s ago
.
.
.
Relevant content
- asked a year ago
- asked 2 years ago
- AWS OFFICIALUpdated a month ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 5 months ago
Thank you for you wonderfully detailed answer, much appreciated. I've checked with
sudo systemctl status crond
and have confirmed the cron scheduler does seem to be running fine (AL2)However, I now notice the jobs have started to run... not exactly sure what changed to make them start.
I'll be upgrading to Linux 2023 at some point, so will take note to ensure
cronie
installation and enablement is part of the environment creation.I'm going to clone my environment to see if that works and runs the jobs without any further intervention, or if there's something else going on.
Thanks Peter