direi finito
This commit is contained in:
@@ -9,6 +9,7 @@ use Passwd::Unix qw(check_sanity reset encpass passwd_file shadow_file
|
||||
exists_group user users users_from_shadow del_group
|
||||
group groups groups_from_gshadow);
|
||||
use File::Path qw( make_path );
|
||||
use Config::Crontab;
|
||||
use Data::Dumper qw(Dumper);
|
||||
|
||||
my $db_adm = 'ase_lar';
|
||||
@@ -395,16 +396,19 @@ sub setCompanyOSSet {
|
||||
or die( getTimeStamp("log") . " - pid $$ >> system @args failed: $?\n" );
|
||||
|
||||
print getTimeStamp("log") . " - pid $$ >> Add crontab db backup.\n";
|
||||
open my $fh, "| crontab -u $company_os_user -"
|
||||
or die( getTimeStamp("log") . " - pid $$ >> Can't open crontab: $!" );
|
||||
my $cron = qx(crontab -l);
|
||||
print $fh
|
||||
"$cron\n0 1 * * * /usr/bin/mysqldump --login-path=asepath --net_buffer_length=4096 "
|
||||
. $company_db_name
|
||||
. " | /bin/bzip2 -c > /home/asega/db_dumps/backup-"
|
||||
. $company_db_name
|
||||
. "-\$(\$TIMESTAMP).sql.bz2 2>> /home/asega/log/dump_db.log";
|
||||
close $fh;
|
||||
my $cron = new Config::Crontab( -owner => 'asega' );
|
||||
$cron->read;
|
||||
$cron->last(
|
||||
new Config::Crontab::Block(
|
||||
-data =>
|
||||
"0 1 * * * /usr/bin/mysqldump --login-path=asepath --net_buffer_length=4096 "
|
||||
. $company_db_name
|
||||
. " | /bin/bzip2 -c > /home/asega/db_dumps/backup-"
|
||||
. $company_db_name
|
||||
. "-\$(\$TIMESTAMP).sql.bz2 2>> /home/asega/log/dump_db.log"
|
||||
)
|
||||
);
|
||||
$cron->write;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user