Update to 2021-07-06 19:00

master
Daniel Berteaud 3 years ago
parent 3ae0ae3f9a
commit e79390ad4c
  1. 6
      roles/backup/files/dump-megaraid-cfg
  2. 8
      roles/backup/files/post-backup
  3. 8
      roles/backup/files/pre-backup

@ -18,7 +18,10 @@ if (-x '/opt/MegaRAID/MegaCli/MegaCli64'){
$megacli = '/opt/MegaRAID/MegaCli/MegaCli'; $megacli = '/opt/MegaRAID/MegaCli/MegaCli';
} }
exit (0) unless($megacli); if (!$megacli){
print "MegaCli not installed, nothing to do\n";
exit 0;
}
my $adapters = 0; my $adapters = 0;
foreach (qx($megacli -adpCount -NoLog)) { foreach (qx($megacli -adpCount -NoLog)) {
@ -42,6 +45,7 @@ foreach my $adp (0..$adapters-1){
next if ($hba && $failgrouplist); next if ($hba && $failgrouplist);
# Save the config in binary format # Save the config in binary format
print "Saving config for adapter $adp\n";
qx($megacli -CfgSave -f /home/lbkp/megaraid/cfg_$adp.bin -a$adp -NoLog); qx($megacli -CfgSave -f /home/lbkp/megaraid/cfg_$adp.bin -a$adp -NoLog);
die "Failed to backup conf for adapter $adp\n" unless ($? == 0); die "Failed to backup conf for adapter $adp\n" unless ($? == 0);

@ -2,7 +2,13 @@
if [ -d "/etc/backup/post.d" ]; then if [ -d "/etc/backup/post.d" ]; then
for H in $(find /etc/backup/post.d -type f -o -type l | sort); do for H in $(find /etc/backup/post.d -type f -o -type l | sort); do
[ -x $H ] && $H "$@" if [ -x $H ]; then
echo "Running hook $H"
$H "$@"
echo "Finished hook $H"
else
echo "Skiping hook $H as it's not executable"
fi
done done
fi fi
# Remove the lock # Remove the lock

@ -24,6 +24,12 @@ fi
touch /var/lock/bkp.lock touch /var/lock/bkp.lock
if [ -d "/etc/backup/pre.d" ]; then if [ -d "/etc/backup/pre.d" ]; then
for H in $(find /etc/backup/pre.d -type f -o -type l | sort); do for H in $(find /etc/backup/pre.d -type f -o -type l | sort); do
[ -x $H ] && $H "$@" if [ -x $H ]; then
echo "Running hook $H"
$H "$@"
echo "Finished hook $H"
else
echo "Skiping hook $H as it's not executable"
fi
done done
fi fi

Loading…
Cancel
Save