2008-04-14 12:22:07 +00:00
|
|
|
#!/bin/sh
|
|
|
|
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
|
|
|
# chkconfig: 345 84 59
|
|
|
|
# description: service node postboot script hack
|
|
|
|
# processname: xcatpostinit
|
|
|
|
|
|
|
|
### BEGIN INIT INFO
|
|
|
|
# Provides: xcatpostinit
|
|
|
|
# Default-Start: 3 4 5
|
|
|
|
# Default-stop: 0 1 2 6
|
2010-07-14 09:57:05 +00:00
|
|
|
# Required-Start: gettyset
|
2009-10-22 09:16:18 +00:00
|
|
|
# Required-Stop:
|
2008-04-14 12:22:07 +00:00
|
|
|
# Short-Description: xCATpost
|
2009-07-10 18:35:40 +00:00
|
|
|
# Description: xCAT post boot script
|
2008-04-14 12:22:07 +00:00
|
|
|
### END INIT INFO
|
|
|
|
|
|
|
|
# Source function library.
|
2009-07-10 18:34:09 +00:00
|
|
|
if [ -x /etc/rc.d/init.d/functions ]; then
|
|
|
|
. /etc/rc.d/init.d/functions
|
|
|
|
fi
|
2008-04-14 12:22:07 +00:00
|
|
|
|
2012-05-15 07:24:11 +00:00
|
|
|
logger -t xcat -p local4.info "$0: action is $1"
|
2008-04-14 12:22:07 +00:00
|
|
|
case $1 in
|
|
|
|
restart)
|
|
|
|
$0 stop
|
|
|
|
$0 start
|
|
|
|
;;
|
|
|
|
status)
|
|
|
|
echo -n "xcatpostinit runs only at boot, runs additional post scripts"
|
2012-05-15 07:24:11 +00:00
|
|
|
logger -t xcat -p local4.info "xcatpostinit runs only at boot, runs additional post scripts"
|
2008-04-14 12:22:07 +00:00
|
|
|
;;
|
|
|
|
stop)
|
|
|
|
echo -n "nothing to stop "
|
2012-05-15 07:24:11 +00:00
|
|
|
logger -t xcat -p local4.info "nothing to stop"
|
2008-04-14 12:22:07 +00:00
|
|
|
;;
|
|
|
|
start)
|
2010-07-14 08:14:16 +00:00
|
|
|
# Node is stateless by default
|
2011-09-07 02:05:53 +00:00
|
|
|
STATELITE=0
|
2010-07-14 08:14:16 +00:00
|
|
|
|
|
|
|
# Node is statelite if /proc/cmdline have flag `STATEMNT='
|
|
|
|
STATELITE_FLAG="STATEMNT="
|
|
|
|
|
|
|
|
# Script to direct further actions
|
|
|
|
SCRIPT="/opt/xcat/xcatdsklspost"
|
|
|
|
|
|
|
|
# Usefull information passed as kernel arguments
|
|
|
|
if [ -f "/proc/cmdline" ]; then
|
|
|
|
if grep --quiet --no-messages "$STATELITE_FLAG" "/proc/cmdline"; then
|
2011-09-07 02:05:53 +00:00
|
|
|
STATELITE=1
|
2010-07-14 08:14:16 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Test for script existance
|
|
|
|
if ! [ -x "$SCRIPT" ]; then
|
|
|
|
msg "can't locate executable $SCRIPT"
|
|
|
|
exit -1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Run $SCRIPT according to node type
|
2011-09-07 02:05:53 +00:00
|
|
|
if [ $STATELITE -ne 0 ]; then
|
2012-05-15 07:24:11 +00:00
|
|
|
logger -t xCAT -p local4.info "Call $SCRIPT for statelite mode"
|
2010-07-14 08:14:16 +00:00
|
|
|
"$SCRIPT" 4
|
|
|
|
else
|
2012-05-15 07:24:11 +00:00
|
|
|
logger -t xCAT -p local4.info "Call $SCRIPT for stateless mode"
|
2010-07-14 08:14:16 +00:00
|
|
|
"$SCRIPT"
|
|
|
|
fi
|
2008-04-14 12:22:07 +00:00
|
|
|
;;
|
|
|
|
esac
|