Run Asterisk as Service

New to linux and asterisk.

Attempting to run Asterisk as service.
chkconfig:
asterisk 0:off 1:off 2:on 3:on 4:on 5:on 6:off

asterisk -r:
Asterisk 1.8.15-cert1, Copyright © 1999 - 2012 Digium, Inc. and others.
Created by Mark Spencer markster@digium.com
Asterisk comes with ABSOLUTELY NO WARRANTY; type ‘core show warranty’ for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type ‘core show license’ for details.

Unable to connect to remote asterisk (does /var/run/asterisk/asterisk.ctl exist?)

ps -ef:
root 1588 1 0 Jan17 ? 00:00:00 /bin/sh /usr/sbin/safe_asterisk
root 1594 1588 0 Jan17 ? 00:01:45 /usr/sbin/asterisk -f -vvvg -c

/var/log/asterisk/messages shows (only “ERROR” i could find):
[Jan 17 10:15:18] ERROR[1645] pbx_spool.c: Unable to open directory /var/spool/asterisk/outgoing: Permission denied

ls -latr /var/spool/asterisk:
drwxrwxrwx. 2 root root 4096 Jan 14 08:53 outgoing

When i start an asterisk session via asterisk -vvvvc, all works without issue… can make calls, and receive calls.

Everything I see here shows asterisk is running as root (yes, i know… it should be a different user)… however, i just want to get this running… then i can play with that. I was hoping someone may give me some insight as to why the service does not seem to want to run? Is there anything else I need to check, or add to this?

Asterisk always runs as a daemon. The normal source code installation process will cause it to be started at startup on Red Hat/CoentOS type systems.

Have you rebooted or run service asterisk start, since you installed it?

What happens if you run service asterisk start?

You need at least execute permission on the whole path to a directory, if opening it from non-root.

This might be an SELINUX issue. You could try disabling that. If it is the problem, and you need to have it on, you will need to change the security tagging on the directory.

I checked on the yum list… it does look like SELinux is installed.

As for the service asterisk start, the [ OK ] does not appear
[root@bor6faxivr01 ~]# service asterisk start
Starting asterisk:

As mentioned in the /var/log/asterisk/messages, there are a few warnings about db.c (for CDRs)… but am not concerned about those… the only ERROR was the outgoing folder.

I just did this:
echo 0 >/selinux/enforce

and the service started up… no errors, and I can connect to the console. So there is definitely something I need to do with selinux. Thanks very much.

Hey,

Don’t forget to configure your /etc/selinux/config and set SELINUX=disabled.

Using this echo 0 >/selinux/enforce will not disable SELINUX at the next boot.

Rgds

Thanks yes, I had already done that.