Skip to content

Instantly share code, notes, and snippets.

@darkcolonist
Last active July 27, 2016 06:42
Show Gist options
  • Save darkcolonist/e7d339560aba18e5276d56161457e799 to your computer and use it in GitHub Desktop.
Save darkcolonist/e7d339560aba18e5276d56161457e799 to your computer and use it in GitHub Desktop.
display crontabs of all users then send as email (run as root)
#!/bin/bash
#List all cron jobs for all users
> cronjobs.sh.out
for user in `cat /etc/passwd | cut -d":" -f1`;
do
echo "# ===== crontabs of $user =====" >> cronjobs.sh.out;
crontab -l -u $user >> cronjobs.sh.out;
done
cat cronjobs.sh.out | mail -s "cronjobs list" [email protected]
rm cronjobs.sh.out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment