Forum Moderators: bakedjake
Anyone have any ideas?
I don't really want to make this into a unix script simply for the fact that it does alot of work and it would take me at least a day to convert the php to unix.....
From a previous thread, i wrote the following:
[webmasterworld.com...]
To achieve this, there are two ways - call the file through the php binary - like you are trying to do (I could not get it to work this way on my server)
OR
as I have done, create a shell script, with the command:
lynx -dump [website.co.uk...]
And then in the cron, simply put:
1 * * * * /path/to/shell/file/shell.sh
31 * * * * /path/to/shell/file/shell.sh
I think this will be the easiest way for you - but this will only work if the lynx browser is installed on your server.
Try from a command prompt:
whereis lynx
and see what response you receive
wruk9999
# minutes hour day of month month of year day of week (0-6; the 0 refers to Sunday) command
#this one is 9:31 am, any day of month, any month of year, on monday->Friday
# This is Sun specific cron, too
31 9 * * 1,2,3,4,5 /usr/local/bin/php /path/to/your/phpfile.php &
I didn't set it to run right away, I'm not in a rush toget it working, I have an option from our admin section of the website to execute the script on demand anyway... Just tryin to make it easier for people.
31 9 * * 1,2,3,4,5 /usr/bin/lynx [mysite.com...]
Your "cron" job on bolt
/usr/local/bin/lynx [mysite.com...]
produced the following output:
<" terminal.'t know anything about your "ÿ$
Your Terminal type is unknown!
Enter a terminal type: [vt100]
<ERMINAL TYPE IS SET TO ÿ$
That was the email exactly...
here is my cron line
0 1 * * 1-5 /usr/local/bin/lynx [mysite.com...]
It's all on one line if it doesn't come up formatted correctly...
when I $whereis lynx
it says /usr/local/bin/ is the path to it so...
Consequently, it sounds like the cronjob you are running is not getting a shell environment that includes "normal" startup stuff like paths and terminal settings. Paths can be gotten around by always specifying the full path, like you've done, but some programs (typically normally interactive ones like vi or lynx) require a terminal setting
So, depending on what the default shell is for the system you are on, you either need to
1. Create an appropriate .cshrc or .profile, probably whichever one you don't currently use.
2. Set the variables you need in a shell script you run from the crontab, presumably running the lynx command or whatever afterwards from that script.