You are not logged in.

#1 2016-06-08 00:51:51

fabiotk
Banned
Registered: 2016-04-03
Posts: 10

Some issues when installing Asterisk 13.9.1 on Arch

Hello. I'm trying to install Asterisk on my arch distro. I followed the simple installing description on wiki and it installed well (./configure..make.. make install), after that I ran make samples to copy the config files. The problem is that the service is not working. When I type sudo systemctl start asterisk it gives me:

Failed to start asterisk.service: Unit asterisk.service not found.

At the asterisk source code folder, I copied the init script (at /asterisk-13.9.1/contrib/init.d/rc.archlinux.asterisk) to the folder /etc/systemd (dunno exactly if this is the right directory) and renaming from rc.archlinux.asterisk to just asterisk, as instructed in this video lesson. The content of the rc.archlinux.asterisk init script is:

. /etc/rc.conf
. /etc/rc.d/functions
DAEMON=/usr/bin/asterisk
ASTVARRUNDIR=/etc/asterisk

case "$1" in
  start)
    stat_busy "Starting Asterisk..."
        if [ ! -d $ASTVARRUNDIR ]; then
                mkdir -p $ASTVARRUNDIR
        fi
    if [ -x $DAEMON ]; then
      # Check if Asterisk is already running.  If it is, then bug out, because
      # starting safe_asterisk when Asterisk is running is very bad.
      VERSION=`${DAEMON} -rx 'core show version' 2>/dev/null`
      if [ "`echo $VERSION | cut -c 1-8`" = "Asterisk" ]; then
         echo "Asterisk is already running.  $0 will exit now."
         exit 1
      fi
          ${DAEMON}
      stat_done
    fi
    ;;
  stop)
    if [ -r ${ASTVARRUNDIR}/asterisk.pid ]; then
      stat_busy "Stopping Asterisk..."
      ${DAEMON} -rx "core stop now" > /dev/null 2&>1
      if [ $? -gt 0 ]; then
        stat_fail
      else
        stat_done
      fi
    fi
    ;;
  restart)
    $0 stop
    sleep 2
    $0 start
    ;;
  *)
    echo "usage $0 start|stop|restart" ;;
esac
exit 0

I'm also having a problem with it, when I run, it don't find both /etc/rc.conf  /etc/rc.d/functions. I'm sorry for being so noob but I really don't know how to install this service so I can start it later with systemctl, I couldn't find answers at google searches.

Offline

#2 2016-06-08 01:27:40

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: Some issues when installing Asterisk 13.9.1 on Arch

The wiki page recommends using the AUR package (which presumably includes a service file), it says nothing about building manually...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2016-06-08 02:13:09

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,571
Website

Re: Some issues when installing Asterisk 13.9.1 on Arch

fabiotk wrote:

./configure..make.. make install

You should pretty much never do this on arch.  Use a PKGBUILD and makepkg/pacman.

fabiotk wrote:

I copied the init script (at /asterisk-13.9.1/contrib/init.d/rc.archlinux.asterisk) to the folder /etc/systemd

This just doesn't make sense.  Initscripts and systemd are not the same thing.  You can't just drop an init script into systemd and expect it to work like a systemd service file.

Please undo everything you have done.  If you are lucky, the makefile will have a complete `uninstall` directive that will get rid of it cleanly, otherwise you have to a bit of investigation.

Once you clean that up, use the aur package already made for this.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

Board footer

Powered by FluxBB