You are not logged in.

#1 2011-02-16 22:25:28

scarletxfi
Member
From: Australia
Registered: 2010-04-19
Posts: 105

cron not sending email from php script, but works fine manually

I have a script running everyday at 2:02 in the morning

crontabe -e: 2 2 * * * /srv/http/site/script.php

the location is correct, as Vim auto completes it, so the file is there for sure.
At the end of the script, I am supposed to get an email(to gmail). But I don't.
I get an mail in /var/mail/user saying the cron job was successful etc, but that's about it.

The thing is, if I run the script just manually (from bash), I get an email (to gmail) properly.

recent upgrades: Pacman -Syu
one reset.

any thoughts?
Thanks,

Offline

#2 2011-02-16 23:01:34

hokasch
Member
Registered: 2007-09-23
Posts: 1,461

Re: cron not sending email from php script, but works fine manually

Maybe "php /srv/http/site/script.php"?

Offline

#3 2011-02-16 23:33:13

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: cron not sending email from php script, but works fine manually

Maybe it needs terminal to run?

Offline

#4 2011-02-16 23:42:06

scarletxfi
Member
From: Australia
Registered: 2010-04-19
Posts: 105

Re: cron not sending email from php script, but works fine manually

@hokasch
Would I need that?
I have "#!/usr/bin/php" in the beginning of the script..(thats how it works by: "/srv/http/site/script.php " from bash)

@karol
it worked before the upgrade.
lets say it needs terminal to run, is there a way to set that up in a cron job?

Last edited by scarletxfi (2011-02-16 23:43:34)

Offline

#5 2011-02-17 08:17:53

scarletxfi
Member
From: Australia
Registered: 2010-04-19
Posts: 105

Re: cron not sending email from php script, but works fine manually

hmm.. it seems to work ok if i start it later. I'm not sure what's going on.

differences:
crontab -e now reads: 51 18 * * * /srv/http/site/script.php  ...

Oh well,
Thanks...

Offline

Board footer

Powered by FluxBB