mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-08-21 10:40:24 +00:00
Add a default systemd unit file based on the auto-generated one from SysV (#5394)
* Add a default systemd unit file based on the auto-generated one from SysV * modify the xcatd testcase when using systemd
This commit is contained in:
@@ -103,7 +103,7 @@ fi
|
||||
%ifos linux
|
||||
if [ -f "/proc/cmdline" ]; then # prevent running it during install into chroot image
|
||||
if [ -f $RPM_INSTALL_PREFIX0/sbin/xcatd ]; then
|
||||
/etc/init.d/xcatd restart
|
||||
XCATROOT=$RPM_INSTALL_PREFIX0 $RPM_INSTALL_PREFIX0/sbin/restartxcatd -r
|
||||
fi
|
||||
fi
|
||||
%else
|
||||
|
@@ -35,6 +35,7 @@ opt/xcat/xdsh
|
||||
opt/xcat/xdsh/Context
|
||||
opt/xcat/ws
|
||||
etc/init.d
|
||||
lib/systemd/system
|
||||
etc/xcat
|
||||
etc/apache2/conf-enabled
|
||||
etc/apache2/conf-available
|
||||
|
@@ -29,6 +29,7 @@ lib/xcat/Confluent/* opt/xcat/lib/perl/Confluent/
|
||||
|
||||
lib/xcat/shfunctions opt/xcat/lib
|
||||
etc/init.d/xcatd etc/init.d
|
||||
etc/init.d/xcatd.service lib/systemd/system/
|
||||
xCAT-wsapi/* opt/xcat/ws/
|
||||
|
||||
LICENSE.html opt/xcat/share/doc/packages/xCAT-server
|
||||
|
@@ -20,15 +20,32 @@ set -e
|
||||
|
||||
case "$1" in
|
||||
configure)
|
||||
. /etc/profile.d/xcat.sh
|
||||
update-rc.d xcatd defaults
|
||||
if [ -f /tmp/xCAT-server_upgrade.tmp ]; then
|
||||
if [ -f "/proc/cmdline" ]; then # prevent running it during install into chroot image
|
||||
/etc/init.d/xcatd reload
|
||||
fi
|
||||
rm /tmp/xCAT-server_upgrade.tmp
|
||||
fi
|
||||
ln -sf /opt/xcat/sbin/xcatd /usr/sbin/xcatd
|
||||
. /etc/profile.d/xcat.sh
|
||||
if [ -f /tmp/xCAT-server_upgrade.tmp ]; then
|
||||
if [ -x /lib/systemd/systemd ]; then
|
||||
if [ -f /run/systemd/generator.late/xcatd.service ]; then
|
||||
# To cover the case upgrade from no xcatd systemd unit file (cannot enable by default for HA case)
|
||||
ls /etc/rc?.d/S??xcatd >/dev/null 2>&1
|
||||
if [ "$?" = "0" ]; then
|
||||
[ -x /usr/sbin/update-rc.d ] && /usr/sbin/update-rc.d xcatd remove
|
||||
/bin/systemctl daemon-reload
|
||||
/bin/systemctl enable xcatd.service
|
||||
fi
|
||||
else
|
||||
/bin/systemctl daemon-reload
|
||||
fi
|
||||
fi
|
||||
# No need to reload xcatd here as it will be covered by xCAT/xCATsn now
|
||||
rm /tmp/xCAT-server_upgrade.tmp
|
||||
else
|
||||
if [ -x /lib/systemd/systemd ]; then
|
||||
/bin/systemctl daemon-reload
|
||||
/bin/systemctl enable xcatd.service
|
||||
else
|
||||
update-rc.d xcatd defaults
|
||||
fi
|
||||
fi
|
||||
ln -sf /opt/xcat/sbin/xcatd /usr/sbin/xcatd
|
||||
;;
|
||||
|
||||
abort-upgrade|abort-remove|abort-deconfigure)
|
||||
|
@@ -24,10 +24,6 @@ case "$1" in
|
||||
;;
|
||||
|
||||
remove)
|
||||
if [ -f "/proc/cmdline" ]; then # prevent running it during install into chroot image
|
||||
/etc/init.d/xcatd stop
|
||||
fi
|
||||
update-rc.d xcatd disable
|
||||
rm -f /usr/sbin/xcatd #remove the symbolic
|
||||
|
||||
rm -f /etc/apache2/conf-enabled/xcat-ws.conf
|
||||
|
44
xCAT-server/debian/prerm
Normal file
44
xCAT-server/debian/prerm
Normal file
@@ -0,0 +1,44 @@
|
||||
#!/bin/sh
|
||||
# prerm script for xCAT-server
|
||||
#
|
||||
# see: dh_installdeb(1)
|
||||
|
||||
set -e
|
||||
|
||||
# summary of how this script can be called:
|
||||
# * <prerm> `remove'
|
||||
# * <old-prerm> `upgrade' <new-version>
|
||||
# * <new-prerm> `failed-upgrade' <old-version>
|
||||
# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
|
||||
# * <deconfigured's-prerm> `deconfigure' `in-favour'
|
||||
# <package-being-installed> <version> `removing'
|
||||
# <conflicting-package> <version>
|
||||
# for details, see http://www.debian.org/doc/debian-policy/ or
|
||||
# the debian-policy package
|
||||
|
||||
|
||||
case "$1" in
|
||||
remove)
|
||||
if [ -f "/proc/cmdline" ]; then # prevent running it during install into chroot image
|
||||
systemctl stop xcatd.service
|
||||
fi
|
||||
systemctl disable xcatd.service
|
||||
;;
|
||||
upgrade|deconfigure)
|
||||
;;
|
||||
|
||||
failed-upgrade)
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "prerm called with unknown argument \`$1'" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# dh_installdeb will replace this with shell code automatically
|
||||
# generated by other debhelper scripts.
|
||||
|
||||
#DEBHELPER#
|
||||
|
||||
exit 0
|
17
xCAT-server/etc/init.d/xcatd.service
Normal file
17
xCAT-server/etc/init.d/xcatd.service
Normal file
@@ -0,0 +1,17 @@
|
||||
[Unit]
|
||||
Description=xCAT management service
|
||||
After=network.target syslog.service
|
||||
|
||||
[Service]
|
||||
EnvironmentFile=-/etc/sysconfig/xcat
|
||||
Type=forking
|
||||
PIDFile=/var/run/xcatd.pid
|
||||
ExecStart=/etc/init.d/xcatd start
|
||||
ExecStop=/etc/init.d/xcatd stop
|
||||
LimitNOFILE=16000
|
||||
RemainAfterExit=no
|
||||
Restart=on-failure
|
||||
RestartSec=5s
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@@ -452,12 +452,6 @@ if ($::INITIALINSTALL || $::FORCE || $::UPDATEINSTALL || $::genCredentials)
|
||||
}
|
||||
else
|
||||
{
|
||||
#since the xcatd service unit file is updated on xcat upgrade
|
||||
#"systemctl daemon-reload" need to be run to update the service unit
|
||||
if ($::UPDATEINSTALL) {
|
||||
$xcmd="type systemctl >/dev/null 2>&1 && systemctl daemon-reload";
|
||||
xCAT::Utils->runcmd("$xcmd", 0);
|
||||
}
|
||||
#$xcmd = "/etc/init.d/xcatd restart";
|
||||
xCAT::Utils->restartservice("xcatd");
|
||||
}
|
||||
@@ -1082,7 +1076,7 @@ sub initDB
|
||||
my $master;
|
||||
$master = xCAT::NetworkUtils->getipaddr($hname);
|
||||
if (!$master) {
|
||||
xCAT::MsgUtils->message("E", "Hostname resolution for $hname failed, setting the site.master to NORESOLUTION for now, after the xCAT installation is finished, fix this hostname resolution problem, change the site.master to the correct value and then resart xcatd.");
|
||||
xCAT::MsgUtils->message("E", "Hostname resolution for $hname failed, setting the site.master to NORESOLUTION for now, after the xCAT installation is finished, fix this hostname resolution problem, change the site.master to the correct value and then restart xcatd.");
|
||||
$master = "NORESOLUTION";
|
||||
}
|
||||
|
||||
|
@@ -327,6 +327,8 @@ chmod 644 $RPM_BUILD_ROOT/%{prefix}/lib/shfunctions
|
||||
%else
|
||||
mkdir -p $RPM_BUILD_ROOT/etc/init.d
|
||||
cp etc/init.d/xcatd $RPM_BUILD_ROOT/etc/init.d
|
||||
mkdir -p $RPM_BUILD_ROOT/usr/lib/systemd/system
|
||||
cp etc/init.d/xcatd.service $RPM_BUILD_ROOT/usr/lib/systemd/system
|
||||
%endif
|
||||
#TODO: the next has to me moved to postscript, to detect /etc/xcat vs /etc/opt/xcat
|
||||
mkdir -p $RPM_BUILD_ROOT/etc/%httpconfigdir
|
||||
@@ -394,6 +396,7 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%if %fsm
|
||||
%else
|
||||
/etc/init.d/xcatd
|
||||
/usr/lib/systemd/system/xcatd.service
|
||||
#/etc/%httpconfigdir/conf.orig/xcat-ws.conf.apache24
|
||||
#/etc/%httpconfigdir/conf.orig/xcat-ws.conf.apache22
|
||||
/etc/apache2/conf.d/xcat-ws.conf
|
||||
@@ -401,6 +404,9 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Fri Jul 6 2018 - Bin Xu <bxuxa@cn.ibm.com>
|
||||
- Added systemd unit file
|
||||
|
||||
* Tue Nov 20 2007 - Jarrod Johnson <jbjohnso@us.ibm.com>
|
||||
- Changes for relocatible rpm.
|
||||
|
||||
@@ -436,7 +442,10 @@ fi
|
||||
ln -sf $RPM_INSTALL_PREFIX0/sbin/xcatd /usr/sbin/xcatd
|
||||
|
||||
if [ "$1" = "1" ]; then #Only if installing for the first time..
|
||||
if [ -x /sbin/chkconfig ]; then
|
||||
if [ -x /usr/lib/systemd/systemd ]; then
|
||||
/usr/bin/systemctl daemon-reload
|
||||
/usr/bin/systemctl enable xcatd.service
|
||||
elif [ -x /sbin/chkconfig ]; then
|
||||
/sbin/chkconfig --add xcatd
|
||||
elif [ -x /usr/lib/lsb/install_initd ]; then
|
||||
/usr/lib/lsb/install_initd /etc/init.d/xcatd
|
||||
@@ -446,6 +455,19 @@ if [ "$1" = "1" ]; then #Only if installing for the first time..
|
||||
fi
|
||||
|
||||
if [ "$1" -gt "1" ]; then #only on upgrade...
|
||||
if [ -x /usr/lib/systemd/systemd ]; then
|
||||
if [ -f /run/systemd/generator.late/xcatd.service ]; then
|
||||
# To cover the case upgrade from no xcatd systemd unit file (cannot enable by default for HA case)
|
||||
ls /etc/rc.d/rc?.d/S??xcatd >/dev/null 2>&1
|
||||
if [ "$?" = "0" ]; then
|
||||
[ -x /sbin/chkconfig ] && /sbin/chkconfig --del xcatd
|
||||
/usr/bin/systemctl daemon-reload
|
||||
/usr/bin/systemctl enable xcatd.service
|
||||
fi
|
||||
else
|
||||
/usr/bin/systemctl daemon-reload
|
||||
fi
|
||||
fi
|
||||
#migration issue for monitoring
|
||||
XCATROOT=$RPM_INSTALL_PREFIX0 $RPM_INSTALL_PREFIX0/sbin/chtab filename=monitorctrl.pm notification -d
|
||||
fi
|
||||
@@ -486,7 +508,9 @@ if [ $1 == 0 ]; then #This means only on -e
|
||||
/etc/init.d/xcatd stop
|
||||
fi
|
||||
|
||||
if [ -x /sbin/chkconfig ]; then
|
||||
if [ -x /usr/lib/systemd/systemd ]; then
|
||||
/usr/bin/systemctl disable xcatd.service
|
||||
elif [ -x /sbin/chkconfig ]; then
|
||||
/sbin/chkconfig --del xcatd
|
||||
elif [ -x /usr/lib/lsb/remove_initd ]; then
|
||||
/usr/lib/lsb/remove_initd /etc/init.d/xcatd
|
||||
|
@@ -56,6 +56,9 @@ check:output=~xcatd service is running|active \(running\)
|
||||
cmd:service xcatd stop
|
||||
check:rc==0
|
||||
cmd:sleep 3
|
||||
cmd:ps axjf |grep -v grep |grep "xcatd:" | wc -l
|
||||
check:rc==0
|
||||
check:output=~0
|
||||
cmd:service xcatd status
|
||||
check:output=~xcatd service|xcatd.service
|
||||
check:output=~xcatd service is not running|inactive \(dead\)
|
||||
|
@@ -79,7 +79,7 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%ifos linux
|
||||
if [ -f "/proc/cmdline" ]; then # prevent running it during install into chroot image
|
||||
if [ -f $RPM_INSTALL_PREFIX0/sbin/xcatd ]; then
|
||||
/etc/init.d/xcatd reload
|
||||
XCATROOT=$RPM_INSTALL_PREFIX0 $RPM_INSTALL_PREFIX0/sbin/restartxcatd -r
|
||||
fi
|
||||
fi
|
||||
%else
|
||||
|
Reference in New Issue
Block a user