Ask Ubuntu Asked by Sagun Shrestha on December 13, 2020
I want see all the jobs that has been scheduled by using cron for the last 1 week (or certain specified time). I used the command
sudo grep CRON /var/log/syslog
But it only shows the log for 1 day. Is there any command in Ubuntu to track them?
You can do this to newer syslog files:
cd /var/log
cat syslog.1 syslog | grep CRON
To the oldest you must do it:
cd /var/log
zcat syslog syslog.4.gz syslog.3.gz syslog.2.gz | grep CRON
It's a good idea to do these commands nested in loops, specially to zcat, since syslog.#.gz are more numerous.
You can even store them into another file to analyze better:
cd /var/log
zcat syslog syslog.4.gz syslog.3.gz syslog.2.gz | grep CRON > ~/cronanalysis.txt
cat syslog.1 syslog | grep CRON >> ~/cronanalysis.txt
The order of syslog files is inverted, so you put older to head and newer events to tail.
Correct answer by Redbob on December 13, 2020
On Amazon Linux you can find it in
/var/log/cron
file
tail /var/log/cron
Answered by Ravi Sethia on December 13, 2020
Another alternative is
sudo zgrep CRON /var/log/syslog*
zgrep
uncompresses files if needed. Options same as for grep
.
Answered by Wirewrap on December 13, 2020
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP