i am getting a 406 error page with this cron.
EDIT
i've updated the cron to use wget instead, but i am still not getting the output from the page. here is the new crontab:
/usr/bin/wget "https://abc.com/cron/sendBulletinEmails.php" >> /home/abc/public_html/cron/logs/sendBulletinEmails.log
however, this is not even using the log file. i get an email instead. here is the email output:
--09:20:01-- https://abc.com/cron/sendBulletinEmails.php
=> `sendBulletinEmails.php'
Resolving abc.com... 69.91.162.123
Connecting to fin-iq.com|69.91.162.123|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
0K 122.58 B/s
09:20:02 (122.58 B/s) - `sendBulletinEmails.php' saved [101]
i've also tried this crontab (to get the right output):
/usr/bin/wget --append-output=/home/abc/public_html/cron/logs/sendBulletinEmails.log "https://abc.com/cron/sendBulletinEmails.php"
but, this too gives me that same log as the email. the page outputs text, which is what i want logged in my log file. any ideas as to how to make that work?
thanks again!
OLD
here is the crontab (copied from cPanel):
* * * * * GET https://abc.com/cron/sendBulletinEmails.php >>
/home/abc/public_html/cron/logs/sendBulletinEmails.log
here is the log:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>406 Not Acceptable</title>
</head><body>
<h1>Not Acceptable</h1>
<p>An appropriate representation of the requested resource /cron/sendSurveyEmails.php could not be found on this server.</p>
<p>Additionally, a 404 Not Found
error was encountered while trying to use an ErrorDocument to handle the request.</p>
</body></html>
also, when i run it from my own browser, it works.
any ideas as to why this is happening? thanks =)
Getting an e-mail from cron is by design. You can disable this by adding
>/dev/null 2>&1
to the end of the line. (Read more about cron here: http://adminschoice.com/crontab-quick-reference)I think the rest of the question could be solved doing a little more reading about wget. You are trying to send the output to a log file using standard output redirection. The contents of that file will only ever be what you would normally see on screen. Wget doesn't display the file itself so output redirection won't work here. The good news is that wget has a built-in switch for managing the output file.
Try this:
The server may be looking for HTTP_USER_AGENT to block automated tools. If available to you, try 'wget'. It supports the
-U or --user-agent=AGENT
switch on the command line to help your script appear as though it's a valid Firefox / Interner Explorer browser session.Otherwise, you might need to write a little script to use more robust features of that Perl module and have the cron job run the script instead of calling get directly. I found some examples of this here: http://perlmeme.org/tutorials/lwp.html