From 2c5fc385b4393e7c34b2882cdcef7da809f64f52 Mon Sep 17 00:00:00 2001 From: Stephen Lane-Walsh Date: Tue, 13 Dec 2022 14:59:06 -0500 Subject: [PATCH] Add socket/service files for running per-connection mdsip servers with systemd --- deploy/packaging/debian/kernel.noarch | 2 ++ deploy/packaging/linux.xml | 8 ++++++++ deploy/packaging/redhat/kernel.noarch | 2 ++ rpm/Makefile.am | 2 +- rpm/mdsip.socket | 13 +++++++++++++ rpm/mdsip@.service | 10 ++++++++++ 6 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 rpm/mdsip.socket create mode 100644 rpm/mdsip@.service diff --git a/deploy/packaging/debian/kernel.noarch b/deploy/packaging/debian/kernel.noarch index 9d74610b6a..643d98e77f 100644 --- a/deploy/packaging/debian/kernel.noarch +++ b/deploy/packaging/debian/kernel.noarch @@ -33,6 +33,8 @@ ./usr/local/mdsplus/pixmaps/tdi.png ./usr/local/mdsplus/rpm/mdsipd.xinetd ./usr/local/mdsplus/rpm/mdsipsd.xinetd +./usr/local/mdsplus/rpm/mdsip.socket +./usr/local/mdsplus/rpm/mdsip@.service ./usr/local/mdsplus/rpm/post_install_script ./usr/local/mdsplus/rpm/post_uninstall_script ./usr/local/mdsplus/rpm/python_module_install.sh diff --git a/deploy/packaging/linux.xml b/deploy/packaging/linux.xml index 0bbd0f5637..31a954140c 100644 --- a/deploy/packaging/linux.xml +++ b/deploy/packaging/linux.xml @@ -438,6 +438,14 @@ then then echo 'mdsip 8000/tcp # MDSplus mdsip service' >> /etc/services fi +fi +if [ ! -r /etc/systemd/system/mdsip.socket ] +then + cp $RPM_INSTALL_PREFIX/mdsplus/rpm/mdsip.socket /etc/systemd/system/mdsip.socket +fi +if [ ! -r /etc/systemd/system/mdsip@.service ] +then + cp $RPM_INSTALL_PREFIX/mdsplus/rpm/mdsip@.service /etc/systemd/system/mdsip@.service fi diff --git a/deploy/packaging/redhat/kernel.noarch b/deploy/packaging/redhat/kernel.noarch index 069583590a..8e2f574781 100644 --- a/deploy/packaging/redhat/kernel.noarch +++ b/deploy/packaging/redhat/kernel.noarch @@ -41,6 +41,8 @@ ./usr/local/mdsplus/rpm ./usr/local/mdsplus/rpm/mdsipd.xinetd ./usr/local/mdsplus/rpm/mdsipsd.xinetd +./usr/local/mdsplus/rpm/mdsip.socket +./usr/local/mdsplus/rpm/mdsip@.service ./usr/local/mdsplus/rpm/post_install_script ./usr/local/mdsplus/rpm/post_uninstall_script ./usr/local/mdsplus/rpm/python_module_install.sh diff --git a/rpm/Makefile.am b/rpm/Makefile.am index 34ecbd69c9..92b6b5c994 100644 --- a/rpm/Makefile.am +++ b/rpm/Makefile.am @@ -9,5 +9,5 @@ dist_rpm_SCRIPTS = post_install_script python_module_install.sh python_module_re if GLOBUSLICENSE dist_rpm_DATA = fusiongrid-mdsip.xinetd fusiongrid-mdsips.xinetd globus-gatekeeper.xinetd globus-gridftp.xinetd else -dist_rpm_DATA = mdsipd.xinetd mdsipsd.xinetd +dist_rpm_DATA = mdsipd.xinetd mdsipsd.xinetd mdsip.socket mdsip@.service endif diff --git a/rpm/mdsip.socket b/rpm/mdsip.socket new file mode 100644 index 0000000000..873fd3ff4b --- /dev/null +++ b/rpm/mdsip.socket @@ -0,0 +1,13 @@ +[Unit] +Description=MDSplus Socket for Per-Connection Servers + +[Socket] +Accept=yes +KeepAlive=true +NoDelay=true +# If we don't force IPv4, the addresses come in from 0.0.0.0 and the host mapping breaks +# Service names don't work here, so we have to use 8000 instead of mdsip +ListenStream=0.0.0.0:8000 + +[Install] +WantedBy=sockets.target diff --git a/rpm/mdsip@.service b/rpm/mdsip@.service new file mode 100644 index 0000000000..c44003682b --- /dev/null +++ b/rpm/mdsip@.service @@ -0,0 +1,10 @@ +[Unit] +Description=MDSplus Per-Connection Server + +[Service] +User=root +Type=forking +# NOTE: If you installed MDSplus to a different location, make sure you change the following line +ExecStart=/usr/local/mdsplus/bin/mdsipd mdsip /var/log/mdsplus/mdsipd +# This spawns the process inetd-style with the incoming socket bound to stdin +StandardInput=socket