add support for cleaning up xcatpost

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@10004 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
ligc 2011-07-04 08:58:30 +00:00
parent 781c652667
commit 1183c25a69
4 changed files with 15 additions and 1 deletions

View File

@ -765,6 +765,9 @@ site => {
" For example: tabdump,nodels,lsdef will not log those cmds.\n".
" ALL will not log any cmds.\n\n".
" blademaxp: The maximum number of processes for blade hardware control.\n\n".
" cleanupxcatpost: (yes/1 or no/0). Set to 'yes' or '1' to clean up the /xcatpost directory\n".
" on the stateless and statelite nodes after the postscripts are run.\n".
" Default is no.\n\n".
" consoleondemand: When set to 'yes', conserver connects and creates the console\n".
" output only when the user opens the console. Default is no on\n".
" Linux, yes on AIX.\n\n".

View File

@ -976,6 +976,7 @@ sub initDB
$chtabcmds .= "$::XCATROOT/sbin/chtab key=sshbetweennodes site.value=ALLGROUPS;";
$chtabcmds .= "$::XCATROOT/sbin/chtab key=dnshandler site.value=ddns;";
$chtabcmds .= "$::XCATROOT/sbin/chtab key=vsftp site.value=y;";
$chtabcmds .= "$::XCATROOT/sbin/chtab key=cleanupxcatpost site.value=no;";
if ($::osname eq 'AIX')
{

View File

@ -349,7 +349,10 @@ if ($nodesetstat eq 'standalone') {
}
}
}
$cleanupxcatpost = `grep "CLEANUPXCATPOST=" $scriptname|awk -F \= '{print \$2}'`;
if ((!$?) && ($cleanupxcatpost =~ /\'1\'|\'yes\'/i)) {
&runcmd("cd /; rm -rf /xcatpost/*");
}
close($::LOG_FILE);
exit 0;

View File

@ -335,6 +335,13 @@ fi
DHCP_TMP=`sed 's/\(DHCPINTERFACES=\)\(.*\)$/\1"\2"/' /tmp/mypostscript`
echo "$DHCP_TMP" > /tmp/mypostscript
CLEANUPXCATPOST=`grep CLEANUPXCATPOST= /tmp/mypostscript |awk -F = '{print $2}'`
if [ "$CLEANUPXCATPOST" = "'1'" ] || [ "$CLEANUPXCATPOST" = "'yes'" ]; then
echo "cd /" >> /tmp/mypostscript
# /xcatpost might be read-only for statelite nodes
echo "rm -rf /xcatpost/*" >> /tmp/mypostscript
fi
chmod +x /tmp/mypostscript
if [ -x /tmp/mypostscript ];then
/tmp/mypostscript