Last active
July 27, 2016 06:42
-
-
Save darkcolonist/e7d339560aba18e5276d56161457e799 to your computer and use it in GitHub Desktop.
display crontabs of all users then send as email (run as root)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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