How to check if a cron job ran?

Moderator: NorbertKrupa

Post Reply
User avatar
Josh
Intermediate
Intermediate
Posts: 106
Joined: Thu Jan 26, 2012 9:38 pm

How to check if a cron job ran?

Post by Josh » Wed Oct 30, 2013 2:03 pm

Hi,

I am setting up a bunch of jobs in cron that run scripts to check for any issues with my Vertica DB. I have one script that is supposed to run every 15 minutes, but I don't think it is :(

How can I check if a cron job ran?
Thank you!
Joshua

User avatar
JimKnicely
Site Admin
Site Admin
Posts: 1822
Joined: Sat Jan 21, 2012 4:58 am
Contact:

Re: How to check if a cron job ran?

Post by JimKnicely » Thu Oct 31, 2013 1:46 pm

If you are using Redhat, CentOS or Fedora you can check the /var/log/cron file.

Example:

Code: Select all

[root@vertica001 ~]# tail -10 /var/log/cron
Oct 31 08:10:01 vertica01 CROND[5688]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Oct 31 08:15:02 vertica01 CROND[6451]: (dbadmin) CMD (~/scripts/db_status/db_status.sh &> ~/scripts/db_status/db_status.log)
Oct 31 08:15:02 vertica01 CROND[6452]: (dbadmin) CMD (~/scripts/node_status/node_status.sh &> ~/scripts/node_status/node_status.log)
Oct 31 08:20:01 vertica01 CROND[7164]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Oct 31 08:30:02 vertica01 CROND[8528]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Oct 31 08:30:02 vertica01 CROND[8529]: (dbadmin) CMD (~/scripts/node_status/node_status.sh &> ~/scripts/node_status/node_status.log)
Oct 31 08:30:02 vertica01 CROND[8531]: (dbadmin) CMD (~/scripts/db_status/db_status.sh &> ~/scripts/db_status/db_status.log)
Oct 31 08:40:01 vertica01 CROND[9860]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Oct 31 08:45:01 vertica01 CROND[10549]: (dbadmin) CMD (~/scripts/node_status/node_status.sh &> ~/scripts/node_status/node_status.log)
Oct 31 08:45:01 vertica01 CROND[10550]: (dbadmin) CMD (~/scripts/db_status/db_status.sh &> ~/scripts/db_status/db_status.log)
Jim Knicely

Image

Note: I work for Vertica. My views, opinions, and thoughts expressed here do not represent those of my employer.

User avatar
Josh
Intermediate
Intermediate
Posts: 106
Joined: Thu Jan 26, 2012 9:38 pm

Re: How to check if a cron job ran?

Post by Josh » Thu Oct 31, 2013 10:25 pm

Thank you, Jim. This will work for me :)
Thank you!
Joshua

Post Reply

Return to “Vertica and the Operating System”