How to list cron jobs of all the users

How to list cron jobs of all the users

while I was doing some server maintenance for a customer last night it required that i find out what cron jobs were in the cron tabs of all the users  on the machine. I found this handy script that will list out all the cron jobs for all the users
[sourcecode language=’sh’]
#!/bin/bash
for user in $(cut -f1 -d: /etc/passwd)
do echo $user && crontab -u $user -l
echo ” ”
done
[/sourcecode]

Enhanced by Zemanta

One Reply to “How to list cron jobs of all the users”

  1. use getent instead of cutting through passwd – what if your users don't come from your /etc/passwd but instead from ldap oder nis?

Leave a Reply

%d bloggers like this: