The British Caving Association

Any views expressed are not necessarily those of the BCA
It is currently Sun 21 Oct 2018 10:44

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Sun 07 Jul 2013 15:45 
Offline
User avatar

Joined: Thu 16 Mar 2006 23:45
Posts: 494
Here's another obscure problem with email, which Im documenting here in case its of use to anybody.

I have a web page at bcra.org.uk which, when accessed, uses a PHP program to generate an email message, which it sends to a Mailing List at list.bcra.org.uk. It works fine when accessed via a browser but fails when run as a scheduled task via CRON. The only difference, I can see, is that when accessed via a browser, the user is the Unix value 'unknown', whereas when run as CRON job the user is BCRA. The specific problem is that Mailman refuses to accept the email. Its sits on the server until delivery times out and then it is returned to Sender. The email log shows the delivery attempt as failed, with e message

Child process of mailman_virtual_transport transport returned 1 from command: /usr/local/cpanel/3rdparty/mailman/mail/mailman

A work-around appears to be to send the mail off-site (I use my Gradwell mail forwarding) and then, from there, route it back to the Mailman list on the BCRA site.

What is happening here? Any ideas anyone?


Top
 Profile  
 
PostPosted: Fri 12 Jul 2013 22:24 
Offline
Site Admin

Joined: Thu 29 Dec 2005 23:22
Posts: 294
Location: Axbridge, Somerset, UK
Can't immediately see why that shouldn't work

BUT your cron command to launch your php script looks decidedly odd (essentially '> php /home/[path]/test5.html')

Does php process html code well?

I think you should try using curl which will allow you to 'execute' a web page from the shell.

Eg:
> curl http://[path]/test5.html > output.txt

or to silence the output:
> curl -s http://[path]/test5.html

See cookies.curl.eg.sh in your bcra/cron directory.

_________________
Dave Cooke
BCA Webmaster, BCA Web Services, National Cave Registry Co-ordinator, CSCC Treasurer


Last edited by David Gibson on Sun 14 Jul 2013 12:25, edited 2 times in total.
removed confidential file path information


Top
 Profile  
 
PostPosted: Sun 14 Jul 2013 11:14 
Offline
User avatar

Joined: Thu 16 Mar 2006 23:45
Posts: 494
David Cooke wrote:
Can't immediately see why that shouldn't work
BUT your cron command to launch your php script looks decidedly odd (essentially 'php [path]/test5.html')
Does php process html code well?

Seems to work OK. I think I once read somewhere that the command line "php some-file-to-parse" requires the PHP code to be encapsulated in tags, from which I inferred that it parses the file just like it would a web page, outputting the html; and indeed that seems to be the case.
David Cooke wrote:
I think you should try using curl which will allow you to 'execute' a web page from the shell.

That sounds more sensible. I will try it, and I will add "curl" to my small repertoire of commands. :-)


Top
 Profile  
 
PostPosted: Sun 14 Jul 2013 12:24 
Offline
User avatar

Joined: Thu 16 Mar 2006 23:45
Posts: 494
OK. CURL seems to be working. Thanks! I guess the salient point may well be that it is executing as "nobody" , (and presumably taking into account my .htaccess settings although I dont think that's relevant here). Whereas my PHP command (which is still a valid thing to do, I assert :-) ) is executing as BCRA and is "merely" parsing the file for PHP. The important point for me to note (as I have other CRON jobs running PHP files) is, I think, the File Permissions thing - viz: the difference between running as BCRA and running as NOBODY.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group