View crontab entries of entire user in FreeBSD

Cron is special utility that process command in periodic time such ;

  • doing regular backup every night
  • email special report every week
  • etc

cron access can be usefull but sometime not, depend on the command issued.

As super user we can list all of entire user crontab entries using log locate in /var/log

su-2.05b# tail -f /var/log/cron
Apr 30 20:30:00 erau /usr/sbin/cron[81893]: (root) CMD (/usr/libexec/atrun)
Apr 30 20:30:00 erau /usr/sbin/cron[81894]: (root) CMD (/usr/local/bin/php /usr/local/share/cacti/poller.php > /dev/null)
Apr 30 20:35:00 erau /usr/sbin/cron[84459]: (root) CMD (/usr/local/bin/php /usr/local/share/cacti/poller.php > /dev/null)
Apr 30 20:35:00 erau /usr/sbin/cron[84462]: (root) CMD (/usr/libexec/atrun)
Apr 30 20:40:00 erau /usr/sbin/cron[87061]: (root) CMD (/usr/libexec/atrun)
Apr 30 20:40:00 erau /usr/sbin/cron[87062]: (root) CMD (/usr/local/bin/php /usr/local/share/cacti/poller.php > /dev/null)
Apr 30 20:45:00 erau /usr/sbin/cron[90181]: (root) CMD (/usr/local/bin/php /usr/local/share/cacti/poller.php > /dev/null)
Apr 30 20:45:00 erau /usr/sbin/cron[90180]: (root) CMD (/usr/libexec/atrun)
Apr 30 20:50:00 erau /usr/sbin/cron[93304]: (root) CMD (/usr/libexec/atrun)
Apr 30 20:50:00 erau /usr/sbin/cron[93305]: (root) CMD (/usr/local/bin/php /usr/local/share/cacti/poller.php > /dev/null)

pay attention on (root) entries, that mean user who run that command in this case generate data for cacti.

You can run the command as root or sudo, otherwise you’ll get “permission denied” message

-bash-2.05b$ tail -f /var/log/cron
tail: /var/log/cron: Permission denied
-bash-2.05b$ su
Password:
kongja# tail -f /var/log/cron
Apr 30 20:36:00 kongja /usr/sbin/cron[81442]: (root) CMD (/usr/local/bin/pfstat -q >>/var/log/pfstat)
Apr 30 20:37:00 kongja /usr/sbin/cron[81504]: (root) CMD (/usr/local/bin/pfstat -q >>/var/log/pfstat)
Apr 30 20:38:00 kongja /usr/sbin/cron[81567]: (root) CMD (/usr/local/bin/pfstat -q >>/var/log/pfstat)
Apr 30 20:39:00 kongja /usr/sbin/cron[81631]: (root) CMD (/usr/local/bin/pfstat -q >>/var/log/pfstat)

happy viewing 🙂

P.S :

other usefull place to check for cron entries

/var/cron/tabs
/var/cron/atjobs
/etc/crontab