Cron Job Setup Correction
-
I am installing Sendy self hosted newsletter on my server. But I don't know is it correct or not my Cron job setup.
# +------------------------ minute (0 - 59) # | +------------------- hour (0 - 23) # | | +-------------- day of month (1 - 31) # | | | +--------- month (1 - 12) # | | | | +---- day of week (0 - 6) (Sunday=0 or 7) # | | | | | # * * * * * command to be executed * * * * * echo "=> Doing job" && php /app/data/public/scheduled.php schedule:run >> /dev/null 2>&1 * * * * * echo "=> Doing job" && php /app/data/public/autoresponders.php schedule:run >> /dev/null 2>&1 * * * * * echo "=> Doing job" && php /app/data/public/import-csv.php schedule:run >> /dev/null 2>&1 * * * * * echo "=> Doing job" && php /app/data/public/update-segments.php schedule:run >> /dev/null 2>&1
Could you check it, please? Thank you.
-
Maybe you need to use the full path to the php version/executable that you're using, e.g.
/usr/bin/php8.1 /app/data/public/scheduled.php schedule:run >> /dev/null 2>&1
@msbt I already added the PHP version on my corn job.
# +------------------------ minute (0 - 59) # | +------------------- hour (0 - 23) # | | +-------------- day of month (1 - 31) # | | | +--------- month (1 - 12) # | | | | +---- day of week (0 - 6) (Sunday=0 or 7) # | | | | | # * * * * * command to be executed * * * * * echo "=> Doing job at $(date)" && /usr/bin/php8.3 /app/data/public/scheduled.php schedule:run >> /dev/null 2>&1 * * * * * echo "=> Doing job at $(date)" && /usr/bin/php8.3 /app/data/public/autoresponders.php schedule:run >> /dev/null 2>&1 * * * * * echo "=> Doing job at $(date)" && /usr/bin/php8.3 /app/data/public/import-csv.php schedule:run >> /dev/null 2>&1 * * * * * echo "=> Doing job job at $(date)" && sudo -u www-data /usr/bin/php8.3 /app/data/public/update-segments.php schedule:run >> /dev/null 2>&1
However, I don't see the "=> Doing job" on my app log. I just saw the external cronjob @nebulon.
Jan 29 21:32:04 141.101.95.92 - - [29/Jan/2025:14:32:04 +0000] "GET /update-segments.php HTTP/1.1" 200 - "-" "Mozilla/4.0 (compatible; cron-job.org; http://cron-job.org/abuse/)" Jan 29 21:32:04 172.71.126.236 - - [29/Jan/2025:14:32:04 +0000] "GET /autoresponders.php HTTP/1.1" 200 - "-" "Mozilla/4.0 (compatible; cron-job.org; http://cron-job.org/abuse/)" Jan 29 21:32:06 172.69.222.223 - - [29/Jan/2025:14:32:06 +0000] "GET /import-csv.php HTTP/1.1" 200 - "-" "Mozilla/4.0 (compatible; cron-job.org; http://cron-job.org/abuse/)"
Is there something that I missed to configure?
-
The pattern itself is correct. I can copy/paste a single line into a random app and I can see the output logs. Can you do
systemctl restart box
? Maybe the cron scheduler is stuck for some reason.