Forum Moderators: bakedjake
This is what is in crontab -l
1 * * * * wget -q -O /dev/null [<website>.com...]
31 * * * * wget -q -O [<website>.com...]
When I go into pine to check root email, I find this message hourly and the url is highlighted in it. (I thought I changed it to send root emails to my email but apparently not)
Subject: Cron <root@hah01> wget -q -O [<website>.com...]
wget: missing URL
Usage: wget [OPTION]... [URL]...
There is also a daily cron email called run-parts /etc/cron.daily that has some errors in it but doesn't mention anything about the above cron job. Could I put this cron job in /etc/cron.hourly and run it that way?
I don't really know if I'm doing this all wrong or what.
Are you trying to actually run the PHP page, so that it runs any commands inside the PHP page?
To achieve this, there are two ways - call the file through the php binary (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 http://www.website.co.uk/myscript.php
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
# if your server supports curl:
0 * * * * curl -s -o /dev/null [your.server.name.here...]
# if your server supports fetch:
0 * * * * fetch -o /dev/null [your.server.name.here...]
# if your server supports lynx:
0 * * * * lynx > /dev/null -dump [your.server.name.here...]
# if your server supports wget:
0 * * * * wget -q -O /dev/null [your.server.name.here...]
Is the manual for phpAdsNew wrong or does this mean that I need to use your method because the other way doesn't work on my server.
# if your server supports lynx:
0 * * * * lynx > /dev/null -dump [your.server.name.here...]Here it is ;)
I just don't put the >/dev/null 'cause I want the output, and also, I put it in a .sh (shell) script because I run a couple of other scripts at the same time.
I also find it easier to run one shell script with as many commands in, than adding them all to the crontab file.
To check whether your server supports lynx, run the whereis lynx command and see whether it has it.
Personally, I prefer the lynx command over wget - but thats a personal preference. (But it was also the only thing that worked for my case.)
wruk999
The server sends out an email for every successful crontab run. The output is in the body, and if your script has executed successfully, and doesn't print anything back to the issuing browser (lynx) then the body of your email will be blank.
If your sending these emails regularly (like twice an hour I think you said) then you may want to turb them off - they could become very annoying. To do so, you can add >& /dev/null to the end of the line inside the crontab file.
So, if you set it up as shown earlier in this thread, inside your crontab, you can have:
1 * * * * /path/to/shell/file/shell.sh >& /dev/null
31 * * * * /path/to/shell/file/shell.sh >& /dev/null
Add this and reload the cron daemon, and you should stop receiving the emails every time the script is run.
wruk999