Generally speaking, the probable difference between manual run of the script and starting of it from cron (or post-boot etc.) is the environment. Usually in such cases there is something wrong with PATH variable.

I'd suggest:
1) check what the environment is during the execution of the script
2) declare PATH explicitly at the beginning of the file