&init_config();
&foreign_require("cron", "cron-lib.pl");
-my $cron_cmd = "$module_config_directory/backup.pl";
-my $backups_dir = "$module_config_directory/backups";
-my $manifests_dir = "/tmp/backup-config-manifests";
+our $cron_cmd = "$module_config_directory/backup.pl";
+our $backups_dir = "$module_config_directory/backups";
+our $manifests_dir = "/tmp/backup-config-manifests";
=head2 list_backup_modules
# Add other files
foreach my $f (@{$_[6]}) {
+ next if (!$f);
if (-d $f) {
# A directory .. recursively expand
foreach my $sf (&expand_directory($f)) {
+ next if (!$sf);
push(@files, $sf);
push(@{$manifestfiles{"other"}}, $sf);
}
}
# Make sure we have something to do
-@files = grep { -e $_ } @files;
+@files = grep { $_ && -e $_ } @files;
@files || (return $text{'backup_enone'});
if (!$_[5]) {
}
elsif ($mode == 1) {
return &text($port ? 'nice_ftpp' : 'nice_ftp',
- "<tt>$server</tt>", "<tt>$path</tt>", "<tt>$port</tt>");
+ "<tt>$server</tt>", "<tt>$path</tt>",
+ $port ? "<tt>$port</tt>" : "");
}
elsif ($mode == 2) {
return &text($port ? 'nice_sshp' : 'nice_ssh',
- "<tt>$server</tt>", "<tt>$path</tt>", "<tt>$port</tt>");
+ "<tt>$server</tt>", "<tt>$path</tt>",
+ $port ? "<tt>$port</tt>" : "");
}
elsif ($mode == 3) {
return $text{'nice_upload'};
# Run the pre-backup command, if any
my $err;
-my $premsg;
+my $premsg = "";
if ($backup->{'pre'} =~ /\S/) {
my $preout = &backquote_command("($backup->{'pre'}) 2>&1 </dev/null");
$premsg = &text('email_pre', $backup->{'pre'})."\n".
}
# Run the post-backup command, if any
-my $postmsg;
+my $postmsg = "";
if (!$err && $backup->{'post'} =~ /\S/) {
my $postout = &backquote_command("($backup->{'post'}) 2>&1 </dev/null");
$postmsg = "\n".
my $host = &get_system_hostname();
my $nice = &nice_dest($backup->{'dest'}, 1);
$nice =~ s/<[^>]+>//g;
- $err =~ s/<[^>]+>//g;
my $msg;
my $subject;
if ($err) {
+ $err =~ s/<[^>]+>//g;
$msg = $premsg.
$text{'email_mods'}."\n".
$mlist.