FS-7495 Add systemd unit configuration file for CentOS 7

This commit is contained in:
Artur Zaprzała 2015-05-22 11:09:22 +02:00 committed by Artur Zaprzała
parent 934e445b6f
commit a1fe44a8b1
3 changed files with 40 additions and 0 deletions

View File

@ -0,0 +1 @@
d /run/freeswitch 0750 freeswitch daemon -

17
build/freeswitch.service Normal file
View File

@ -0,0 +1,17 @@
[Unit]
Description=FreeSWITCH
After=syslog.target network.target
After=postgresql.service postgresql-9.3.service postgresql-9.4.service mysqld.service httpd.service
[Service]
User=freeswitch
EnvironmentFile=-/etc/sysconfig/freeswitch
# RuntimeDirectory is not yet supported in CentOS 7. A workaround is to use /etc/tmpfiles.d/freeswitch.conf
#RuntimeDirectory=/run/freeswitch
#RuntimeDirectoryMode=0750
WorkingDirectory=/run/freeswitch
ExecStart=/usr/bin/freeswitch -nc -nf $FREESWITCH_PARAMS
ExecReload=/usr/bin/kill -HUP $MAINPID
[Install]
WantedBy=multi-user.target

View File

@ -1670,8 +1670,14 @@ cd ../..
%if 0%{?suse_version} > 100
%{__install} -D -m 744 build/freeswitch.init.suse %{buildroot}/etc/rc.d/init.d/freeswitch
%else
%if "%{?_unitdir}" == ""
# On RedHat like
%{__install} -D -m 0755 build/freeswitch.init.redhat %{buildroot}/etc/rc.d/init.d/freeswitch
%else
# systemd
%{__install} -Dpm 0644 build/freeswitch.service %{buildroot}%{_unitdir}/freeswitch.service
%{__install} -Dpm 0644 build/freeswitch-tmpfiles.conf %{buildroot}%{_tmpfilesdir}/freeswitch.conf
%endif
%endif
# On SuSE make /usr/sbin/rcfreeswitch a link to /etc/rc.d/init.d/freeswitch
%if 0%{?suse_version} > 100
@ -1723,9 +1729,18 @@ fi
chown freeswitch:daemon /var/log/freeswitch /var/run/freeswitch
%if "%{?_unitdir}" == ""
chkconfig --add freeswitch
%else
%tmpfiles_create freeswitch
/usr/bin/systemctl -q enable freeswitch.service
%endif
%preun
%{?systemd_preun freeswitch.service}
%postun
%{?systemd_postun freeswitch.service}
######################################################################################################################
#
# On uninstallation get rid of the freeswitch user
@ -1794,7 +1809,12 @@ fi
######################################################################################################################
%config(noreplace) %attr(0644,-,-) %{HTDOCSDIR}/*
%ifos linux
%if "%{?_unitdir}" == ""
/etc/rc.d/init.d/freeswitch
%else
%{_unitdir}/freeswitch.service
%{_tmpfilesdir}/freeswitch.conf
%endif
%config(noreplace) /etc/sysconfig/freeswitch
%if 0%{?suse_version} > 100
/usr/sbin/rcfreeswitch
@ -2482,6 +2502,8 @@ fi
#
######################################################################################################################
%changelog
* Tue Jul 09 2015 - Artur Zaprzała
- add systemd service file for CentOS 7
* Thu Jun 25 2015 - s.safarov@gmail.com
- Dependencies of mod_shout were declared
* Mon Jun 22 2015 - krice@freeswitch.org