0

I need to build a new machine and copy properties and some cron jobs from another machine which has about 200+ users and I don't know which users have cron jobs configured. Is there a way to extract the list of users which has cron jobs configured?

Itai Ganot
  • 10,644
  • 29
  • 93
  • 146

1 Answers1

4

How about looking in the crontabs spool directory? On my machine (CentOS 6), that's /var/spool/cron:

[me@lory ~]$ sudo ls -al /var/spool/cron/
total 56
drwx------.  2 root     root  4096 Nov 23  2013 .
drwxr-xr-x. 17 root     root  4096 Aug 16  2012 ..
-rw-------.  1 root     root   252 Oct  2  2008 carol
-rw-------.  1 root     root   504 Sep 22  2006 david
-rw-------.  1 root     root   515 Sep 22  2006 gsy
-rw-------.  1 root     users  191 Mar 19  2005 hfeinst
-rw-------.  1 ja       ja     147 Jun 26  2013 ja
-rw-------.  1 jkript   root   690 Jan  2  2012 jkript
-rw-------.  1 root     root    90 Feb  1  2007 lu
[...]
MadHatter
  • 79,770
  • 20
  • 184
  • 232
  • 1
    Don't overlook the cron jobs set by your fellow administrators which can be in anywhere in `/etc/crontab` , `/etc/cron.d/` , `/etc/cron.[hourly|daily|weekly|monthly]` in addition to `/var/spool/cron/root`. – HBruijn Jul 22 '14 at 12:12
  • 1
    An excellent point, and thank you for making it, even though the original question specifies users' jobs. – MadHatter Jul 22 '14 at 12:33
  • non-privileged users vs admin users. – Michael Martinez Jul 22 '14 at 18:43