/etc/init.d script and calling asterisk command line.

Home » Asterisk Users » /etc/init.d script and calling asterisk command line.
Asterisk Users 4 Comments

I have written a program that monitors asterisk to make sure my peers and
channels are all in good order. The program calls asterisk once a min and
then parses the output. The program works fine when launched from the
command line. I then wrote a script to launch the program with the hope of
launching it on boot up from /etc/init.d. When I log into a terminal
session and run the script I am able to start/stop/status on the program
and all is good. When I copy the same script to the /etc/init.d folder and
run it the program fails to be able to access the asterisk bin.

In all three cases I am logged in as root. The script is owned by root and
all it’s permissions set. Anyone have any idea why running my startup
script from the /etc/init.d folder would act differently?

I am running asterisk 1.8.x, On opensuse 11.x. The startup script is
launching a mono application.

Any ideas would be appreciated.

Thanks

Bryant

4 thoughts on - /etc/init.d script and calling asterisk command line.

  • You want your program to live in /usr/local/bin. /etc/init.d is where the
    bash scripts that run programs that live elsewhere are housed. It is not a
    good practice to put executeables there. For example, /etc/init.d/asterisk
    runs /usr/sbin/safe-asterisk. The scenario I typically use is that
    /etc/init.d/foo runs /usr/local/bin/bar and puts its’ output in
    /var/log/foobar.

    [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Bryant
    Zimmerman
    Sent: Tuesday, January 17, 2012 8:12 AM
    command line.

    I have written a program that monitors asterisk to make sure my peers and
    channels are all in good order. The program calls asterisk once a min and
    then parses the output. The program works fine when launched from the
    command line. I then wrote a script to launch the program with the hope of
    launching it on boot up from /etc/init.d. When I log into a terminal session
    and run the script I am able to start/stop/status on the program and all is
    good. When I copy the same script to the /etc/init.d folder and run it the
    program fails to be able to access the asterisk bin.
    In all three cases I am logged in as root. The script is owned by root and
    all it’s permissions set. Anyone have any idea why running my startup
    script from the /etc/init.d folder would act differently?

    I am running asterisk 1.8.x, On opensuse 11.x. The startup script is
    launching a mono application.

    Any ideas would be appreciated.

    Thanks

    Bryant

  • Just to be overly pedantic, your issue had nothing to do with ‘running
    from /etc/init.d/’ (or the symlinks to the scripts in that directory) but
    had everything to do with the environment of the process that executed the
    script.