[asterisk-users] System() command refuses to execute bash script

Stefan Viljoen viljoens at verishare.co.za
Mon Mar 2 08:44:48 CST 2015


Hi all

I got this solved.

Turns out the script WAS executing, but I forgot that apparently you need to
follow "cron rules" in any BASH scripts executed via System() from an
Asterisk dialplan.

E. g. all paths must be fully and absolutely specified, there are no
relative path references available.

So I changed the the file wireless.sh which was:

#!/bin/bash
touch wireless-executed

to

#!/bin/bash
touch /root/wireless-executed

and now if I phone 800 on my Asterisk context I can see that the file 

wireless-executed

is created by the touch binary, which indicates that Asterisk has run the
script successfully.

So the problem was not Asterisk or BASH or permissions, but rather that it
appears that all paths in any System() script must be absolutely, not
relatively, specified.

Hope this helps somebody - simply follow "cron rules" when writing
Asterisk-callable BASH scripts which you plan to trigger via the System()
Asterisk dialplan application.

Regards

Stefan




More information about the asterisk-users mailing list