FS-8194 FS-7910 FS-7937 systemd service improvements
freeswitch-systemd.freeswitch.service: * starting the daemon as root and switchig to freeswitch user * respecting the options in /etc/default/freeswitch * RuntimeDirectory parameter is replaced with a tmpfiles.d entry because /run/freeswitch has to be owned by freeswitch user * instructions how to start it as non-root debian/freeswitch-systemd.freeswitch.tmpfile: * this defines the PID directory with correct permissions debian/bootstrap.sh, debian/rules: * proper handling of freeswitch.service * deleted debian/freeswitch-systemd.install because it caused an error in dh_install because it's run before dh_installinit * renamed: freeswitch-sysvinit.freeswitch.default -> freeswitch-systemd.freeswitch.default because sysvinit support will eventually die out debian/freeswitch.postinst: * run "systemctl enable freeswitch" if systemctl is available CAVEAT: only one option is supported in /etc/default/freeswitch because the variable ${DAEMON_OPTS} is expanded as a single token. This will be fixed as soon as freeswitch-sysvinit is removed from freeswitch-all.
This commit is contained in:
parent
a5a3561b2b
commit
b2bcc8b2dd
|
@ -1324,8 +1324,14 @@ for x in postinst postrm preinst prerm; do
|
||||||
cp -a freeswitch.$x freeswitch-all.$x
|
cp -a freeswitch.$x freeswitch-all.$x
|
||||||
done
|
done
|
||||||
cp -a freeswitch-doc.docs freeswitch-all.docs
|
cp -a freeswitch-doc.docs freeswitch-all.docs
|
||||||
#cp -a freeswitch-systemd.freeswitch.service freeswitch-all.freeswitch.service
|
|
||||||
cp -a freeswitch-sysvinit.freeswitch.default freeswitch-all.freeswitch.default
|
cp -a freeswitch-systemd.freeswitch.service freeswitch-all.freeswitch.service
|
||||||
|
cp -a freeswitch-systemd.freeswitch.tmpfile freeswitch-all.freeswitch.tmpfile
|
||||||
|
cp -a freeswitch-systemd.freeswitch.default freeswitch-all.freeswitch.default
|
||||||
|
|
||||||
|
cp -a freeswitch-systemd.freeswitch.default freeswitch-sysvinit.freeswitch.default
|
||||||
|
|
||||||
|
# TODO: FS-7928 need to add a condition and skip this for jessie and onward
|
||||||
cp -a freeswitch-sysvinit.freeswitch.init freeswitch-all.freeswitch.init
|
cp -a freeswitch-sysvinit.freeswitch.init freeswitch-all.freeswitch.init
|
||||||
|
|
||||||
echo "Generating additional lintian overrides..." >&2
|
echo "Generating additional lintian overrides..." >&2
|
||||||
|
|
|
@ -8,14 +8,14 @@ After=syslog.target network.target local-fs.target
|
||||||
; service
|
; service
|
||||||
Type=forking
|
Type=forking
|
||||||
PIDFile=/run/freeswitch/freeswitch.pid
|
PIDFile=/run/freeswitch/freeswitch.pid
|
||||||
ExecStart=/usr/bin/freeswitch -ncwait -nonat
|
Environment="DAEMON_OPTS=-nonat"
|
||||||
|
EnvironmentFile=-/etc/default/freeswitch
|
||||||
|
ExecStart=/usr/bin/freeswitch -u freeswitch -g freeswitch -ncwait ${DAEMON_OPTS}
|
||||||
TimeoutSec=45s
|
TimeoutSec=45s
|
||||||
Restart=always
|
Restart=always
|
||||||
; exec
|
; exec
|
||||||
RuntimeDirectory=freeswitch
|
User=root
|
||||||
RuntimeDirectoryMode=0755
|
Group=daemon
|
||||||
User=freeswitch
|
|
||||||
Group=freeswitch
|
|
||||||
LimitCORE=infinity
|
LimitCORE=infinity
|
||||||
LimitNOFILE=100000
|
LimitNOFILE=100000
|
||||||
LimitNPROC=60000
|
LimitNPROC=60000
|
||||||
|
@ -28,5 +28,27 @@ CPUSchedulingPolicy=rr
|
||||||
CPUSchedulingPriority=89
|
CPUSchedulingPriority=89
|
||||||
UMask=0007
|
UMask=0007
|
||||||
|
|
||||||
|
; alternatives which you can enforce by placing a unit drop-in into
|
||||||
|
; /etc/systemd/system/freeswitch.service.d/*.conf:
|
||||||
|
;
|
||||||
|
; User=freeswitch
|
||||||
|
; Group=freeswitch
|
||||||
|
; ExecStart=
|
||||||
|
; ExecStart=/usr/bin/freeswitch -ncwait -nonat -rp
|
||||||
|
;
|
||||||
|
; empty ExecStart is required to flush the list.
|
||||||
|
;
|
||||||
|
; if your filesystem supports extended attributes, execute
|
||||||
|
; setcap 'cap_net_bind_service,cap_sys_nice=+ep' /usr/bin/freeswitch
|
||||||
|
; this will also allow socket binding on low ports
|
||||||
|
;
|
||||||
|
; otherwise, remove the -rp option from ExecStart and
|
||||||
|
; add these lines to give real-time priority to the process:
|
||||||
|
;
|
||||||
|
; PermissionsStartOnly=true
|
||||||
|
; ExecStartPost=/bin/chrt -f -p 1 $MAINPID
|
||||||
|
;
|
||||||
|
; execute "systemctl daemon-reload" after editing the unit files.
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
d /var/run/freeswitch 0755 freeswitch freeswitch - -
|
|
@ -1 +0,0 @@
|
||||||
/lib/systemd/system/freeswitch.service
|
|
|
@ -37,6 +37,9 @@ case "$1" in
|
||||||
mkdir -p /etc/freeswitch/tls/
|
mkdir -p /etc/freeswitch/tls/
|
||||||
chown freeswitch:freeswitch /etc/freeswitch/tls
|
chown freeswitch:freeswitch /etc/freeswitch/tls
|
||||||
fi
|
fi
|
||||||
|
if [ -x /bin/systemctl -a x`systemctl is-enabled freeswitch` != "xenabled" ]; then
|
||||||
|
systemctl enable freeswitch
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
abort-upgrade|abort-remove|abort-deconfigure)
|
abort-upgrade|abort-remove|abort-deconfigure)
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -98,12 +98,11 @@ override_dh_strip:
|
||||||
override_dh_auto_install:
|
override_dh_auto_install:
|
||||||
dh_auto_install
|
dh_auto_install
|
||||||
dh_auto_install -- -C libs/esl pymod-install
|
dh_auto_install -- -C libs/esl pymod-install
|
||||||
mkdir -p debian/tmp/lib/systemd/system
|
|
||||||
install -m0644 debian/freeswitch-systemd.freeswitch.service debian/tmp/lib/systemd/system/freeswitch.service
|
|
||||||
rm -f debian/tmp/usr/share/freeswitch/grammar/model/communicator/COPYING
|
rm -f debian/tmp/usr/share/freeswitch/grammar/model/communicator/COPYING
|
||||||
|
|
||||||
override_dh_installinit:
|
override_dh_installinit:
|
||||||
dh_installinit -pfreeswitch-sysvinit --name=freeswitch
|
dh_installinit -pfreeswitch-sysvinit --name=freeswitch
|
||||||
|
dh_installinit -pfreeswitch-systemd --name=freeswitch
|
||||||
dh_installinit -pfreeswitch-all --name=freeswitch
|
dh_installinit -pfreeswitch-all --name=freeswitch
|
||||||
|
|
||||||
override_dh_makeshlibs:
|
override_dh_makeshlibs:
|
||||||
|
|
Loading…
Reference in New Issue