Oct 2 16:38:23 localhost systemd[1]: Starting Asterisk PBX and telephony daemon…
Oct 2 16:39:54 localhost systemd[1]: asterisk.service: Start operation timed out. Terminating.
Oct 2 16:39:54 localhost systemd[1]: asterisk.service: Failed with result ‘timeout’.
Oct 2 16:39:54 localhost systemd[1]: Failed to start Asterisk PBX and telephony daemon…
Oct 2 16:39:58 localhost systemd[1]: asterisk.service: Service RestartSec=4s expired, scheduling restart.
Oct 2 16:39:58 localhost systemd[1]: asterisk.service: Scheduled restart job, restart counter is at 1.
but, If i ran command - “/usr/sbin/asterisk -C /etc/asterisk/asterisk.conf”, It works well
where do i find cause ?
If you compiled and installed from source, check <sourcedir>/include/asterisk/autoconfig.h around line 1055 and make sure that systemd support is enabled…
/* Define if your system has the SYSTEMD libraries. */
#define HAVE_SYSTEMD 1
If not, you may need to install the systemd-devel package then re-run ./configure and make.
cd /home/ippbx/PKG/5.Asterisk/asterisk-16.5.1
cp -f ./contrib/systemd/asterisk* /usr/lib/systemd/system/
and change asterisk user ( asterisk to ippbx )
sed -i ‘s/User=asterisk/User=ippbx/g’ /usr/lib/systemd/system/asterisk.service;
sed -i ‘s/Group=asterisk/Group=ippbx/g’ /usr/lib/systemd/system/asterisk.service
systemctl enable asterisk
finally I reboot system and check asterisk process…
BUT, I found issue
I CAN NOT found directory, /var/run/asterisk <-- ( as /etc/asterisk/asterisk.conf’s astrundir )
I recreate /var/run/asterisk like this
[root@localhost run]# pwd
/var/run
[root@localhost run]# ll
합계 28
drwxr-xr-x 3 root root 60 10월 7 11:36 NetworkManager
-rw------- 1 root root 0 10월 7 11:36 agetty.reload
drwxr-xr-x 2 ippbx ippbx 40 10월 7 11:53 asterisk
and then, I reboot system.
But Asterisk run directory(/var/run/asterisk) was deleted. I can’t found
where did I check ?
Asterisk will try and create /var/run/asterisk if it doesn’t already exist but it can’t do that if it’s started as a non-root user, in your case “ippbx”. There are several ways to solve this…
Remove the User and Group lines from the service file so Asterisk starts as root. This will allow it to create the /var/run/asterisk directory before it switches over to the user and group specified in asterisk.conf.
Use ExecStartPre commands in the service file to create the directory and set its ownership to ippbx/ippbx.
Create a file named /etc/tmpfiles.d/asterisk.conf with the following line in it then run sudo systemd-tmpfiles --create. The directory will then get created every time the system starts.