mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-08-21 18:50:28 +00:00
Return correct return code from enablekdump postscript
This commit is contained in:
@@ -85,6 +85,7 @@ if [ ! -z "$DUMP" ]; then
|
||||
KDPATH=${KDPATH/\/\//}
|
||||
KDIP=`echo $KDPATH | cut -d'/' -f1`
|
||||
KDPATH=${KDPATH/$KDIP/}
|
||||
retval=0
|
||||
|
||||
# if "dump=<proto>:///<directory>", use $xcatmaster as the default NFS server
|
||||
if [ -z $KDIP ]; then
|
||||
@@ -182,6 +183,7 @@ EOF
|
||||
/bin/rm -rf "/var/tmp/tempinit"
|
||||
#service kdump restart
|
||||
restartservice kdump
|
||||
retval=$?
|
||||
else
|
||||
/bin/mount -o nolock $KDIP:$KDPATH $MOUNTPATH
|
||||
KDTEMPPATH=${KDPATH//\//\\\/}
|
||||
@@ -264,6 +266,7 @@ EOF
|
||||
fi
|
||||
[ -f /etc/dracut.conf ] && mv /etc/dracut.conf /tmp/dracut.conf
|
||||
restartservice kdump
|
||||
retval=$?
|
||||
[ -f /tmp/dracut.conf ] && mv /tmp/dracut.conf /etc/dracut.conf
|
||||
elif (pmatch $OSVER "fedora*") || (pmatch $OSVER "rhel6*") || (pmatch $OSVER "rhels6*") || [ -f /etc/fedora-release ] || [ -f /etc/redhat-release ];then
|
||||
/bin/mount -o nolock $KDIP:$KDPATH $MOUNTPATH
|
||||
@@ -271,6 +274,7 @@ EOF
|
||||
echo "link_delay 180" >> /etc/kdump.conf
|
||||
#/etc/init.d/kdump restart
|
||||
restartservice kdump
|
||||
retval=$?
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
@@ -280,4 +284,4 @@ else
|
||||
/bin/echo "The kdump server is not configured"
|
||||
fi
|
||||
|
||||
exit 0
|
||||
exit $retval
|
||||
|
@@ -512,11 +512,15 @@ function restartservice {
|
||||
fi
|
||||
|
||||
#for the linux distributions with systemd support
|
||||
#In the chrooted env, the system management commands(start/stop/restart) will be ignored and the return code is 0
|
||||
#need to return the proper code in the chrooted scenario
|
||||
local retmsg
|
||||
retmsg=`$cmd 2>&1`
|
||||
retval=$?
|
||||
|
||||
#If non 0 return code, display failure message
|
||||
[ "$retval" = "1" ] && echo "$retmsg"
|
||||
|
||||
#In the chrooted env, the system management commands(start/stop/restart) will be ignored and the return code is 0
|
||||
#need to return the proper code in the chrooted scenario
|
||||
[ "$retval" = "0" ] && (echo "$retmsg" | grep -i "Running in chroot,\s*ignoring request.*" >/dev/null 2>&1) && retval=1
|
||||
|
||||
return $retval
|
||||
|
Reference in New Issue
Block a user