I have this shell script at /usr/local/1.sh:
#!/bin/sh
wget -r -np --user=peter --password='123' ftp://67.225.87.95/ -p /test/
If I run it using
# sh 1.sh
the script executes ok and does what its supposed to do.
But if I create a cron job to execute the exact same script:
1 2 * * * /usr/local/bin/1.sh
the script is not executed at all.
What could be wrong?
1 2 * * * /usr/local/bin/1.sh > /var/log/1.log 2>&1
If you are going run it directly without invoking the shell interprer, you need to provide the appropriate permissions:
Otherwise, run the interpreter against its:
Replace:
By:
or
Keep it:
And prepend the following to
/usr/local/bin/1.sh
:(you may need to replace
/bin/bash
by whateverwhich bash
is telling you)