For some reason, on some Debian installs or user accounts, /sbin
is not in path, even when running as root.
This is typically where Asterisk is installed but if /sbin is not in path, then asterisk and related commands will fail without an absolute path.
Now that we support installing Asterisk to locations besides /sbin (e.g. /usr/local/...), absolute paths should be avoided, even as constants.
It should be determined why /sbin is not in $PATH and it should be added. This could be even for the duration of the script, which would allow commands in the script to function regardless of where the asterisk binary (and other related binaries) are located. Since /sbin should be in path anyways, ideally that should be exported and persist beyond script execution, but this isn't strictly necessary.
/sbin is only in path for root. Using sudo su
will not add it to path but su -
will add it to path.
In any case, relying on existing path should be avoided.
You must be
11/14/2021 9:01 AM — InterLinked
Correction: we are dealing with plain /sbin here, not /usr/sbin