I had a similar problem, but I fixed it:
It was because I ran some other scripts, from the script.
These were not working, because I did not include the full path.
Maybe you're having similar problems, try including full path's to the executables in the script, it might work.
It did for me