crontab - /bin/sh: wget: command not found
It's probably something to do with your environment being different when it's run as a cron job (ie the PATH
environment variable is different than what you're using from a bash terminal).
In your bash terminal, use which
to figure out which wget
is being used:
laptop [ ~ ]: which wget
/opt/local/bin/wget
Then use the full path in the cron job:
*/10 * * * * /opt/local/bin/wget -O - -q -t 1 http://site.local/cron.php
For cron jobs, I usually have it run a bash script instead of specifying the command directly in the crontab. It's a bit easier to debug and keeps the crontab a bit cleaner.
To find out where a certain command is located try:
which wget
or
which <certain-command>
The output should provide the path of the executable. For example:
linux-dgr7:~ # sudo which wget
/usr/bin/wget
then change the entry like so:
*/10 * * * * /usr/bin/wget -O - -q -t 1 http://site.local/cron.php
If the wget does not come up after doing which... you should add the location to the PATH variable.
PATH=$PATH:/where/ever/path/is
or
PATH=$PATH:/opt/wget