System don't work

I using

exten => 0001,1,System(bash ./script.sh)

When I run
asterisk -vvvvgc
everything works fine, but when I run the asterisk normally it either fails to execute [exten => 0001,1,System(bash /etc/asterisk/script.sh)]
or error unable to execute [exten => 0001,1,System(bash ./script.sh)].

Processes are started by the same users
File:
-rwx------ 1 asterisk asterisk script.sh

system(echo 123)
Don’t work too

Yous should give the complete PATH eg /etc/asterisk/script.sh or /usr/bin/echo

I tried it, script do nothing

Did you try:

exten => 0001,1,System(/bin/bash /etc/asterisk/script.sh)

Have you tried running the exact command as the Asterisk user manually, from a shell?

Eg.

yourusername@host:~$ sudo su - asterisk -s $SHELL
asterisk@host:~$ /bin/bash /etc/asterisk/script.sh

on a different note clean it up with changing the premissing and remove the /bin/bash

chmod +x /etc/asterisk/script.sh
exten => 0001,1,System(/etc/asterisk/script.sh)

Only works if an appropriate shebang line is present. I’ve seen shell scripts where this is NOT the case, or where it was pointing to something not present on every system the script were intended to run on.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.