2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-06-17 17:10:48 +00:00
Files
xcat-core/xCAT/postscripts/xcatpostinit1.install
T
Bin Xu c0074cf8ab Add the 'postbooting' status to indicate xCAT start to handle postboot tasks (#4346) (#4369)
- for diskful, it will be set when leaving 'booting' stage
 - for diskless, it will be set when leaving 'netbooting' stage
 - for diskful reboot, it will set when (site.runpostscript=1)
 - modify the document accordingly
 - also modify GlobalDef.pm, but it won't have impact as the status will not be in nodeset operation.
2018-01-19 02:39:11 -06:00

55 lines
2.2 KiB
Bash
Executable File

#!/bin/bash
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
# chkconfig: 345 84 59
# description: the hook for systemd service unit to run PB and report node status on diskful node
# processname: xcatpostinit1
### BEGIN INIT INFO
# Provides: xcatpostinit1
# Required-Start: $network $syslog
# Should-Start:
# Required-Stop: $network $syslog
# Should-Stop:
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6
# Short-Description: hook to run xcat PBS and report node status
# Description:
### END INIT INFO
# Source function library.
if [ -x /etc/rc.d/init.d/functions ]; then
. /etc/rc.d/init.d/functions
fi
[ -f /opt/xcat/xcatinfo ] && XCATSERVER=`grep 'XCATSERVER' /opt/xcat/xcatinfo |cut -d= -f2 | tr -d \'\" `
[ -f /xcatpost/mypostscript ] && NODESTATUS=`grep 'NODESTATUS=' /xcatpost/mypostscript |awk -F = '{print $2}'|tr -d \'\" | tr A-Z a-z `
[ -z "$NODESTATUS" ] && NODESTATUS="1"
[ -f /xcatpost/mypostscript ] && RUNBOOTSCRIPTS=`grep 'RUNBOOTSCRIPTS=' /xcatpost/mypostscript |awk -F = '{print $2}' | tr -d \'\" | tr A-Z a-z `
case $1 in
stop)
[ "$NODESTATUS" != "n" ] && /xcatpost/updateflag.awk $XCATSERVER 3002 "installstatus powering-off"
;;
start)
# check for the REBOOT specified in xcatinfo to run post boot scripts on reboot
if [ -f /opt/xcat/xcatinfo ]; then
REBOOT=`grep 'REBOOT' /opt/xcat/xcatinfo |cut -d= -f2 | tr -d \'\"`
fi
# if the xcatdsklspost file exists and this is a reboot - run xcatdsklspost with a mode of 6
if [ "$REBOOT" = "TRUE" -a -r /opt/xcat/xcatdsklspost ] && [[ "$RUNBOOTSCRIPTS" =~ ^(1|yes|y)$ ]]; then
[ "$NODESTATUS" != "n" ] && /xcatpost/updateflag.awk $XCATSERVER 3002 "installstatus postbooting"
# xcatdsklspost will set the status to 'booted' or 'failed'
/opt/xcat/xcatdsklspost 6
elif [ "$REBOOT" = "TRUE" ] && [[ "$NODESTATUS" =~ ^(1|yes|y)$ ]]; then
/xcatpost/updateflag.awk $XCATSERVER 3002 "installstatus booted"
else
[ "$NODESTATUS" != "n" ] && /xcatpost/updateflag.awk $XCATSERVER 3002 "installstatus postbooting"
# run /opt/xcat/xcatinstallpost, it will set the status to 'booted' or 'failed'
if [ -r /opt/xcat/xcatinstallpost ]; then
/opt/xcat/xcatinstallpost
fi
fi
;;
esac