Skip to content

Instantly share code, notes, and snippets.

@thartl
Last active September 21, 2024 17:17
Show Gist options
  • Select an option

  • Save thartl/03bb7f2080afddc52a69e3cb7787c2af to your computer and use it in GitHub Desktop.

Select an option

Save thartl/03bb7f2080afddc52a69e3cb7787c2af to your computer and use it in GitHub Desktop.
#!/bin/bash
# Prints a list of wp cron schedules on servers set up by SpinupWP.
# Includes only standard wp cron events, nothing custom.
#
# Setup:
# cd /usr/bin/
# sudo vim get_cron_schedules.sh
# -- paste in the contents of this file and save
# sudo chmod 755 get_cron_schedules.sh
#
# Run script as a sudo user
cd /home/[sudo user name]
crons=$(sudo grep -rHi "wp cron event run --due-now" /var/spool/cron* | sed 's/^\/var.*crontabs\/\(\S*\):\(.*\)\s*cd \/sites\/.*$/\2\t\1/')
crons=$(echo -e "$crons" | sort -n)
echo "$crons"
echo Done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment