I am running the following command every 5 minutes in my crontab to keep Phusion Passenger alive.
*/5 * * * * wget mysite.com > /dev/null 2>&1
When I run this it performs a wget on the site url routes STDOUT/STDERR to /dev/null. When I run this from a command line it works fine and doesn't produce an index.html file in my home directory.
When it runs from cron, it creates a new index.html file every five minutes, leaving me with a ton of index files which I don't want.
Is my syntax incorrect for running the cron job? From a command line it works without a problem but from cron it generates a index.html file in my home directory.
I'm sure I'm making a simple mistake, would appreciate it if anyone could help out.
Best Answer
You could do it like this:
Here
-O
sends the downloaded file to/dev/null
and-o
logs to/dev/null
instead of stderr. That way redirection is not needed at all.