STOLI - cron jobs and mail()

Status
Not open for further replies.

cybrax

Community Advocate
Community Support
Messages
764
Reaction score
27
Points
0
Hi guys,

am tinkering with a database and log file backup script and it's behaving oddly.

The script runs fine manually, extracting sql data and selected folder files and sending them as an email with attached folder containing the zipped data ...

at least it is to yahoo but not a gmail address (did say it was odd) was wondering if you can see any errors bouncing back from gmail?

As for the Cron job, it's set to every ten minutes for setup/testing but does not appear to be triggering. I don't set these up very often and can never recall if there is supposed to be a space between eg: php /cybrax or just php/cybrax

0,10 * * * * /usr/bin/php /home/cybrax/public_html/backup.php
Probably something I've done wrong this end, so any suggestions welcome.

---------- Post added at 01:55 AM ---------- Previous post was at 01:31 AM ----------

tweeked some of the script settings and trying again
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
A command line like:

Code:
/usr/bin/php /home/igor/public_html/mail_test.php >>/home/igor/public_html/mail_test_log.txt 2>&1

will log any output (ie echo) and any error messages (even system errors).

I have a feeling you might see:

Code:
Can't do setuid (cannot exec sperl)

if you are using PHP mail(). For some reason mail() will not work under cron (the script runs as a different user than when you run the script from the Web).
 

cybrax

Community Advocate
Community Support
Messages
764
Reaction score
27
Points
0
cron is ok now - jst waiting on email to arrive at yahoo - delay is around twenty minutes

ok will add the error log to command and see what I get

---------- Post added at 02:26 AM ---------- Previous post was at 02:08 AM ----------

Thanks Descalzo,

will look at changing script to use SMTP mail alternative

---------- Post added at 03:29 AM ---------- Previous post was at 02:26 AM ----------

gaaagh.... cron permissions

SMTP Error: Could not connect to SMTP host.
Mailer Error: SMTP Error: Could not connect to SMTP host.

oh well, got a couple of other ideas will try them later tomorrow
 
Last edited:
Status
Not open for further replies.
Top