Post Backup script error

I have a script that uses expect to upload CDR backup files to a SFTP server. I can use the script from the command line but I get :Executing Post Backup Hook: CDRupload.sh
sh: CDRupload.sh: command not found When it is run as a post script. I have the permissions and the owner set to 777 and asterisk. Here is the script:

#!/usr/bin/expect
spawn sftp [email protected]
expect “password:”
send “Password!\n”
expect “sftp>”
#send “cd logdirectory\n”
#expect “sftp>”
send “put /var/spool/asterisk/backup/*.gz\n”
expect “sftp>”
send “exit\n”
expect eof
exit

any ideas as to why this isn’t working?

Explicitly tell it the location of your script.

Thanks Sorvani That helped alot. I no longer get an error but the file(s) aren’t uploaded. It may be timing out

Not timing out as far as I can tell.

Setup the script to create a log. Running it from the command line creates a log, but not from the backup

OK so the script is not running from the backup module. What owner and permissions are needed? Just guessing that this is the issue. I set it to 777/asterisk.asterisk Still won’t run from the backup module. The module says that it finished without errors, but that is a lie.