303.473.4400 / Toll Free: 888.772.0777
Select Page

Our Magento Programming team here at Customer Paradigm was trying to figure out why a cron was not firing for a Magento Enterprise site.

Cron is a system that tells a Magento site to start specific events at specific times.  For example, if you want to have a coupon that gives free shipping for all users, cron might invoke a script that runs and updates the site.  Crons are also used to help with the daily maintenance of the site, including rebuilding caches and indexes for Magento.

The issue was that there were no cron tab entries listed under the usual root user on the site.  And there were a ton of users in the system.  How can you find out which user had an entry into the cron?

Our Magento Programming team used a stack overflow article, and modified it to work for our needs.

Basically, it loops through all of the various users in the system, and then displays who has cron entries.  This trick saved us a couple of hours of time.

Here are the technical details:

We needed a way to list every cron job for every user in a system, to find, for example, if the Magento cron.sh or cron.php are being run from the Unix cron. Here’s how to do it:
for user in $(cut -f1 -d: /etc/passwd); do echo $user; crontab -u $user -l; done
You may need to add a sudo before the command on some systems, like this:
alias cron_list_all=’for user in $(cut -f1 -d: /etc/passwd); do echo $user; sudo crontab -u $user -l; done’
We used this stack overflow article as a starting place, and then modified it for our use:

Pin It on Pinterest

Share This