diff --git a/mtce/debian/deb_folder/crashDumpMgr.service b/mtce/debian/deb_folder/crashDumpMgr.service new file mode 100644 index 00000000..bec36c04 --- /dev/null +++ b/mtce/debian/deb_folder/crashDumpMgr.service @@ -0,0 +1,12 @@ +[Unit] +Description=Crash Dump Manager +After=network.target +Before=sshd.service + +[Service] +Type=oneshot +RemainAfterExit=no +ExecStart=/etc/init.d/crashDumpMgr --max-size 5Gi + +[Install] +WantedBy=multi-user.target diff --git a/mtce/debian/deb_folder/fsmon.service b/mtce/debian/deb_folder/fsmon.service new file mode 100644 index 00000000..5f858502 --- /dev/null +++ b/mtce/debian/deb_folder/fsmon.service @@ -0,0 +1,23 @@ +[Unit] +Description=StarlingX Maintenance Filesystem Monitor +After=network.target syslog.service config.service +Before=pmon.service + +[Service] +Type=forking +ExecStart=/etc/init.d/fsmon start +ExecStop=/etc/init.d/fsmon stop +ExecReload=/etc/init.d/fsmon reload +PIDFile=/var/run/fsmond.pid + +# Failure handling +TimeoutStartSec=10s +TimeoutStopSec=10s + +# restarted by pmon +Restart=no +RestartSec=5 + +[Install] +WantedBy=multi-user.target + diff --git a/mtce/debian/deb_folder/goenabled.service b/mtce/debian/deb_folder/goenabled.service new file mode 100644 index 00000000..5dd5f171 --- /dev/null +++ b/mtce/debian/deb_folder/goenabled.service @@ -0,0 +1,13 @@ +[Unit] +Description=StarlingX Maintenance Goenable Ready +After=config.service +Before=pmon.service + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/etc/init.d/goenabled start +ExecStop=/etc/init.d/goenabled stop + +[Install] +WantedBy=multi-user.target diff --git a/mtce/debian/deb_folder/hostw.service b/mtce/debian/deb_folder/hostw.service new file mode 100644 index 00000000..5b226a88 --- /dev/null +++ b/mtce/debian/deb_folder/hostw.service @@ -0,0 +1,23 @@ +[Unit] +Description=StarlingX Maintenance Host Watchdog +After=syslog.service network.target hbsClient.service mtcClient.service sm.service fsmon.service + + +[Service] +Type=forking +ExecStart=/etc/init.d/hostw start +ExecStop=/etc/init.d/hostw stop +ExecReload=/etc/init.d/hostw reload +PIDFile=/var/run/hostwd.pid + +# Failure handling +TimeoutStartSec=10s +TimeoutStopSec=10s + +# Auto recovery +Restart=always +RestartSec=10 + +[Install] +WantedBy=multi-user.target + diff --git a/mtce/debian/deb_folder/mtcClient.service b/mtce/debian/deb_folder/mtcClient.service new file mode 100644 index 00000000..463dee1f --- /dev/null +++ b/mtce/debian/deb_folder/mtcClient.service @@ -0,0 +1,22 @@ +[Unit] +Description=StarlingX Maintenance Command Handler Client +After=network.target syslog.service config.service +Before=pmon.service + +[Service] +Type=forking +ExecStart=/etc/init.d/mtcClient start +ExecStop=/etc/init.d/mtcClient stop +ExecReload=/etc/init.d/mtcClient reload +PIDFile=/var/run/mtcClient.pid +KillMode=process +SendSIGKILL=no + +# Process recovery is handled by pmond if its running. +# Delay 10 seconds to give pmond a chance to recover +# before systemd kicks in to do it as a backup plan. +Restart=always +RestartSec=10 + +[Install] +WantedBy=multi-user.target diff --git a/mtce/debian/deb_folder/mtce-hostw.install b/mtce/debian/deb_folder/mtce-hostw.install index 71429a2a..7bedc11f 100644 --- a/mtce/debian/deb_folder/mtce-hostw.install +++ b/mtce/debian/deb_folder/mtce-hostw.install @@ -1,5 +1,4 @@ etc/init.d/hostw etc/logrotate.d/hostw.logrotate etc/mtc/hostwd.conf -lib/systemd/system/hostw.service usr/bin/hostwd diff --git a/mtce/debian/deb_folder/mtce-pmon.install b/mtce/debian/deb_folder/mtce-pmon.install index 1e9ec0e6..6511063f 100644 --- a/mtce/debian/deb_folder/mtce-pmon.install +++ b/mtce/debian/deb_folder/mtce-pmon.install @@ -1,7 +1,6 @@ etc/init.d/pmon etc/logrotate.d/pmon.logrotate etc/mtc/pmond.conf -lib/systemd/system/pmon.service usr/bin/pmond usr/lib/libamon.so usr/lib/libamon.so.1 diff --git a/mtce/debian/deb_folder/mtce.install b/mtce/debian/deb_folder/mtce.install index c965978e..a741dd99 100644 --- a/mtce/debian/deb_folder/mtce.install +++ b/mtce/debian/deb_folder/mtce.install @@ -31,10 +31,6 @@ etc/services.d/controller/mtcTest etc/services.d/storage/mtcTest etc/services.d/worker/mtcTest etc/syslog-ng/conf.d/mtce.conf -lib/systemd/system/crashDumpMgr.service -lib/systemd/system/fsmon.service -lib/systemd/system/goenabled.service -lib/systemd/system/mtcClient.service usr/lib/ocf/resource.d/platform/mtcAgent usr/bin/fsmond usr/bin/hbsAgent diff --git a/mtce/debian/deb_folder/pmon.service b/mtce/debian/deb_folder/pmon.service new file mode 100644 index 00000000..44337bc0 --- /dev/null +++ b/mtce/debian/deb_folder/pmon.service @@ -0,0 +1,25 @@ +[Unit] +Description=StarlingX Maintenance Process Monitor +After=config.service +# The following thirdparty service files are not modified by StarlingX, +# so add "After" clauses here rather than "Before=pmon.service" to those +After=sshd.service acpid.service syslog-ng.service +After=ntpd.service ptp4l.service phc2sys.service +Before=hostw.service + +[Service] +Type=forking +ExecStart=/etc/init.d/pmon start +ExecStop=/etc/init.d/pmon stop +ExecReload=/etc/init.d/pmon reload +PIDFile=/var/run/pmond.pid +KillMode=process + +# Failure handling +TimeoutStartSec=10s +TimeoutStopSec=10s +Restart=always +RestartSec=2 + +[Install] +WantedBy=multi-user.target diff --git a/mtce/debian/deb_folder/rules b/mtce/debian/deb_folder/rules index 3c0b5d4c..3f97b909 100644 --- a/mtce/debian/deb_folder/rules +++ b/mtce/debian/deb_folder/rules @@ -88,15 +88,6 @@ override_dh_auto_install: install -m 755 -p -D scripts/hwclock.sh $(MTCESHAREDIR)/hwclock.sh install -m 644 -p -D scripts/hwclock.service $(MTCESHAREDIR)/hwclock.service - # systemd service files - install -m 755 -d $(UNITDIR) - install -m 644 -p -D fsmon/scripts/fsmon.service $(UNITDIR)/fsmon.service - install -m 644 -p -D pmon/scripts/pmon.service $(UNITDIR)/pmon.service - install -m 644 -p -D hostw/scripts/hostw.service $(UNITDIR)/hostw.service - install -m 644 -p -D scripts/crashDumpMgr.service $(UNITDIR)/crashDumpMgr.service - install -m 644 -p -D scripts/mtcClient.service $(UNITDIR)/mtcClient.service - install -m 644 -p -D scripts/goenabled.service $(UNITDIR)/goenabled.service - # go enabled script install -m 755 -p -D scripts/goenabled $(INITDIR)/goenabled @@ -157,11 +148,18 @@ override_dh_auto_install: install -m 755 -d $(ROOT)/var/run override_dh_installsystemd: + dh_installsystemd --name crashDumpMgr + dh_installsystemd --name fsmon + dh_installsystemd --name goenabled dh_installsystemd --name hbsClient + dh_installsystemd --name hostw + dh_installsystemd --name hwclock dh_installsystemd --name hwmon dh_installsystemd --name lmon dh_installsystemd --name mtcalarm + dh_installsystemd --name mtcClient dh_installsystemd --name mtclog + dh_installsystemd --name pmon dh_installsystemd --name runservices override_dh_usrlocal: diff --git a/mtce/src/fsmon/scripts/fsmon b/mtce/src/fsmon/scripts/fsmon index 6d8abcc0..b34e468a 100644 --- a/mtce/src/fsmon/scripts/fsmon +++ b/mtce/src/fsmon/scripts/fsmon @@ -17,10 +17,22 @@ # Short-Description: fsmon daemon ### END INIT INFO -. /etc/init.d/functions +CENTOS_FUNCTIONS="/etc/init.d/functions" +DEBIAN_FUNCTIONS="/lib/lsb/init-functions" +if [ ! -f ${CENTOS_FUNCTIONS} ] ; then + . ${DEBIAN_FUNCTIONS} +else + . ${CENTOS_FUNCTIONS} +fi DAEMON_NAME="fsmond" -DAEMON="/usr/local/bin/${DAEMON_NAME}" +DAEMON_CENTOS_PATH="/usr/local/bin/${DAEMON_NAME}" +DAEMON_DEBIAN_PATH="/usr/bin/${DAEMON_NAME}" +if [ ! -f ${DAEMON_CENTOS_PATH} ] ; then + DAEMON=${DAEMON_DEBIAN_PATH} +else + DAEMON=${DAEMON_CENTOS_PATH} +fi PIDFILE="/var/run/${DAEMON_NAME}.pid" # Linux Standard Base (LSB) Error Codes diff --git a/mtce/src/hostw/scripts/hostw b/mtce/src/hostw/scripts/hostw index 82a4aaf1..6872f6ca 100644 --- a/mtce/src/hostw/scripts/hostw +++ b/mtce/src/hostw/scripts/hostw @@ -19,10 +19,22 @@ # echo "7:3:respawn:/usr/local/bin/hostwd" >> /etc/inittab -. /etc/init.d/functions +CENTOS_FUNCTIONS="/etc/init.d/functions" +DEBIAN_FUNCTIONS="/lib/lsb/init-functions" +if [ ! -f ${CENTOS_FUNCTIONS} ] ; then + . ${DEBIAN_FUNCTIONS} +else + . ${CENTOS_FUNCTIONS} +fi DAEMON_NAME="hostwd" -DAEMON="/usr/local/bin/${DAEMON_NAME}" +DAEMON_CENTOS_PATH="/usr/local/bin/${DAEMON_NAME}" +DAEMON_DEBIAN_PATH="/usr/bin/${DAEMON_NAME}" +if [ ! -f ${DAEMON_CENTOS_PATH} ] ; then + DAEMON=${DAEMON_DEBIAN_PATH} +else + DAEMON=${DAEMON_CENTOS_PATH} +fi IFACE="" if [ ! -e "$DAEMON" ] ; then diff --git a/mtce/src/pmon/scripts/pmon b/mtce/src/pmon/scripts/pmon index bdc3ab7d..a3ef242d 100644 --- a/mtce/src/pmon/scripts/pmon +++ b/mtce/src/pmon/scripts/pmon @@ -19,10 +19,22 @@ # echo "7:3:respawn:/usr/local/bin/pmond" >> /etc/inittab -. /etc/init.d/functions +CENTOS_FUNCTIONS="/etc/init.d/functions" +DEBIAN_FUNCTIONS="/lib/lsb/init-functions" +if [ ! -f ${CENTOS_FUNCTIONS} ] ; then + . ${DEBIAN_FUNCTIONS} +else + . ${CENTOS_FUNCTIONS} +fi DAEMON_NAME="pmond" -DAEMON="/usr/local/bin/${DAEMON_NAME}" +DAEMON_CENTOS_PATH="/usr/local/bin/${DAEMON_NAME}" +DAEMON_DEBIAN_PATH="/usr/bin/${DAEMON_NAME}" +if [ ! -f ${DAEMON_CENTOS_PATH} ] ; then + DAEMON=${DAEMON_DEBIAN_PATH} +else + DAEMON=${DAEMON_CENTOS_PATH} +fi IFACE="" if [ ! -e "$DAEMON" ] ; then diff --git a/mtce/src/scripts/hwclock.sh b/mtce/src/scripts/hwclock.sh index 8adb9b8e..4ab09b02 100755 --- a/mtce/src/scripts/hwclock.sh +++ b/mtce/src/scripts/hwclock.sh @@ -21,7 +21,13 @@ # in /etc/default/rcS, or in the proper place below. # Source function library. -. /etc/init.d/functions +CENTOS_FUNCTIONS="/etc/init.d/functions" +DEBIAN_FUNCTIONS="/lib/lsb/init-functions" +if [ ! -f ${CENTOS_FUNCTIONS} ] ; then + . ${DEBIAN_FUNCTIONS} +else + . ${CENTOS_FUNCTIONS} +fi [ ! -x /sbin/hwclock ] && exit 0 diff --git a/mtce/src/scripts/mtcClient b/mtce/src/scripts/mtcClient index 11136899..78adc60f 100644 --- a/mtce/src/scripts/mtcClient +++ b/mtce/src/scripts/mtcClient @@ -17,10 +17,22 @@ # Short-Description: Maintenance Client Daemon ### END INIT INFO -. /etc/init.d/functions +CENTOS_FUNCTIONS="/etc/init.d/functions" +DEBIAN_FUNCTIONS="/lib/lsb/init-functions" +if [ ! -f ${CENTOS_FUNCTIONS} ] ; then + . ${DEBIAN_FUNCTIONS} +else + . ${CENTOS_FUNCTIONS} +fi DAEMON_NAME="mtcClient" -DAEMON="/usr/local/bin/${DAEMON_NAME}" +DAEMON_CENTOS_PATH="/usr/local/bin/${DAEMON_NAME}" +DAEMON_DEBIAN_PATH="/usr/bin/${DAEMON_NAME}" +if [ ! -f ${DAEMON_CENTOS_PATH} ] ; then + DAEMON=${DAEMON_DEBIAN_PATH} +else + DAEMON=${DAEMON_CENTOS_PATH} +fi PIDFILE="/var/run/${DAEMON_NAME}.pid" PLATFORM_CONF="/etc/platform/platform.conf"