add cron entry for reorg tables

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@9628 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
lissav 2011-05-18 12:01:20 +00:00
parent c4a270200b
commit 79e1ca20b6

View File

@ -433,6 +433,9 @@ if (($::INIT) && ($::xcatrunningdb2 == 0))
xCAT::MsgUtils->message("I",
"xCAT is running on the DB2 database.\n");
# add cron entry for table reorg
&updatecrontab;
}
else # client
{
@ -1685,6 +1688,28 @@ sub restorexcatdb
}
#-----------------------------------------------------------------------------
=head3 updatecrontab
Sets up a crontab entry to reorg the database, once a week on Sunday
night midnight
=cut
#-----------------------------------------------------------------------------
sub updatecrontab
{
my $cmd="/opt/xcat/share/xcat/tools/reorgtbls";
my $entry="0 0 * * 0 $cmd";
my ($code, $msg)=xCAT::Utils::add_cron_job($entry);
if ($code==0) {
xCAT::MsgUtils->message("I", " A crontab entry has been added to run DB2 table reorg once a week on Sunday 12pm\n If you would like to change this time, use crontab -e to modify the entry for reorgtbls execution\n You may also limit the tables to reorg but using the -t parameter on reorgtbls.\n See reorgtbls -h.");
} else {
xCAT::MsgUtils->message("W", " Failed to add crontab entry for Table reorg.");
}
}
#-----------------------------------------------------------------------------
=head3 adddb2paths
Add paths to db2 commands to /etc/profile and ~.profile