#cron
12 one-liners with this tag.
All one-liners tagged cron
Check which scripts in cron.daily actually run
$run-parts --test /etc/cron.daily
Delete a scheduled WP-Cron event
$wp cron event delete old_plugin_daily_event --path=/var/www/vhosts/example.com/httpdocs
Find out which cron job runs a command
#grep -rn "wp-cron.php" /etc/crontab /etc/cron.d /etc/cron.hourly /etc/cron.daily /etc/cron.weekly /etc/cron.monthly /var/spool/cron/crontabs 2>/dev/null
List scheduled WP-Cron events
$wp cron event list --fields=hook,next_run_relative,recurrence --path=/var/www/vhosts/example.com/httpdocs
Prevent overlapping cron jobs with flock
$flock -n /tmp/backup.lock /usr/local/bin/backup.sh
Run a PHP script with a specific Plesk PHP version
$/opt/plesk/php/8.3/bin/php /var/www/vhosts/example.com/httpdocs/cron.php
Run all scripts in cron.daily right now
#run-parts --verbose /etc/cron.daily
Run due WP-Cron events immediately
$wp cron event run --due-now --path=/var/www/vhosts/example.com/httpdocs
Show currently running cron jobs
$ps -eo pid,user,etime,cmd --forest | grep -A3 '[C]RON'
Show system-wide cron jobs in /etc/crontab and /etc/cron.d
$grep -vE '^\s*(#|$)' /etc/crontab /etc/cron.d/*
Show the cron log: when which job ran
#journalctl -u cron --since today --no-pager
Test a command in the minimal cron environment
$env -i SHELL=/bin/sh PATH=/usr/bin:/bin HOME="$HOME" LOGNAME="$(id -un)" /bin/sh -c 'wp --path=/var/www/vhosts/example.com/httpdocs cron event run --due-now'