Skip to content

Instantly share code, notes, and snippets.

@Zenexer
Last active December 20, 2015 01:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Zenexer/6047598 to your computer and use it in GitHub Desktop.
Save Zenexer/6047598 to your computer and use it in GitHub Desktop.
List all cronjobs on system.
#!/bin/bash
for user in $(cut -f1 -d: /etc/passwd); do
CRONTAB="$(sudo crontab -u "$user" -l 2> /dev/null | sed '/^[[:space:]]*#/d; /^[[:space:]]*$/d')"
if (( $? )) || [ -z "$CRONTAB" ]; then
continue
fi
echo "# CRONTAB FOR: $user"
echo "$CRONTAB"
echo "# END CRONTAB FOR: $user"
echo
done
@Zenexer
Copy link
Author

Zenexer commented Jul 21, 2013

wget https://gist.github.com/Zenexer/6047598/raw/lscron && chmod +x lscron
# OR
curl -o lscron https://gist.github.com/Zenexer/6047598/raw/lscron && chmod +x lscron

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment