Verified:
Sudo crontab -e and i see the job configured
/etc/cron.d/itflow and i see the job with cronkey
"systemctl status cron" shows active
If i manually run for the mail queue it works.
Suggestions on what to check?
Verified:
Sudo crontab -e and i see the job configured
/etc/cron.d/itflow and i see the job with cronkey
"systemctl status cron" shows active
If i manually run for the mail queue it works.
Suggestions on what to check?
You don't need the cron key anymore.
You can add the following to the end of the cron job to add logging
2>&1 | logger -t itflow-cron
Then tail the syslog to see the error its generating
Sudo crontab -e and i see the job configured
-
/etc/cron.d/itflow and i see the job with cronkey
Have your cron job in one, or the other. Don't have it in both. I'd suggest /etc/cron.d/itflow myself.
Remove the cronkey, we don't use that anymore.
Take away the sudo -u
, you just need the time, name of the user and the command to run, e.g.:
0 2 * * * www-data /usr/bin/php /var/www/itflow.example.com/scripts/cron.php
Is the nightly cron job running?
Add the following to the ned of the mail queue job: 2>&1 | logger -t itflow-mailqueue
and then grep your syslog for itflow-mailqueue
magixnetworks snap!
wrongecho Have your cron job in one, or the other. Don't have it in both. I'd suggest /etc/cron.d/itflow myself.
Ended up leaving it under the "ETC" directory, everything else has been corrected but I'm not showing the CRON job running on a nightly basis. The app log does not show any history of it running.
Did you turn on Cron from Admin -> Settings ->Notifications?
it's enabled and has been turned off and on as well
Can you post a screenshot of your updated configuration? Ideally of the entire line like you did in the second screenshot of winscp
MistahJ_94 then maybe you try changing it over to sudo crontab -e
and see what happens?
wrongecho Can you post a screenshot of your updated configuration? Ideally of the entire line like you did in the second screenshot of winscp
Here you go
Also on a side note,
Checking /var/mail/www-data
the last log event i see is from March 11th, nothing after that, i am assuming something has happened and cron is no longer working automatically.
If i run either command
"sudo -u www-data php /var/www/portal.helixsolutions.co/scripts/cron.php"
or
"sudo -u www-data php /var/www/portal.helixsolutions.co/scripts/cron_mail_queue.php"
The jobs complete just fine, so im scratching my head, perhaps maybe switch the cron user to root?
What did you get when you grep'ed your syslog for itflow-
?
I have performed additional troubleshooting steps. Here is what has changed.
Most up to date Cron file configuration:
I've made a test output for Cron
I have verified file using the following commands
"ls -l /etc/cron.d/" (Made sure the file did not have any dots or extensions)
"cat /etc/cron.d/itflow" (Made sure this was part of it
"* * * * * www-data /usr/bin/php /var/www/portal.helixsolutions.co/scripts/cron_mail_queue.php >> /var/log/itflow_parser.log 2>&1)
"ls -l /etc/cron.d/itflow" (Verified permissions and ownership to verify it had a similar output to this "-rw-r--r-- 1 root root ...")
"echo >> /etc/cron.d/itflow" (Made sure it ended with a newline)
"systemctl restart cron" (Restarted Cron)
"journalctl -u cron -f" (Watched Cron live)
"sudo -u www-data /usr/bin/php /var/www/portal.helixsolutions.co/scripts/cron_mail_queue.php" (Ran PHP script manually and it's functional)
So you're now sending output to /var/log/itflow_parser.log? What does that file say?
there was a typo its not going to "itflow_parser.log" its going to "itflow_mailqueue.log"
The file is created but log is empty
Okay, so lets just change it back to 2>&1 | logger -t itflow
and use journalctl -f --all
to see what's going on?
It looks like i may have gotten it working
It looks like the cron environment outside of shell is limited and the cron job isn't able to find the path needed. I modified it to this line in the cron file and it seems to be working now.This ensures that the cron job has access to the necessary system paths.
"* * * * * www-data PATH=/usr/sbin:/usr/bin:/sbin:/bin /usr/bin/php /var/www/portal.helixsolutions.co/scripts/cron_mail_queue.php"
For others that may experience this issue, I added "PATH=/usr/sbin:/usr/bin:/sbin:/bin"
That's handy to know.. What OS are you running?
Running Debian 12 (Bookworm) - latest release as of today
MistahJ_94 What do you get if you run which php
?