settings can override the defaults in the Lang files.
#
#========================================================================
#
-# Version 1.6.0_CVS, released 10 Dec 2002.
+# Version 2.0.0_CVS, released 18 Jan 2003.
#
# See http://backuppc.sourceforge.net.
#
#========================================================================
use strict;
-use lib "/usr/local/BackupPC/lib";
+use lib "__INSTALLDIR__/lib";
use BackupPC::Lib;
use BackupPC::FileZIO;
use Data::Dumper;
use Getopt::Std;
use DirHandle ();
+use vars qw($Lang $TopDir $BinDir %Conf);
die("BackupPC::Lib->new failed\n") if ( !(my $bpc = BackupPC::Lib->new) );
-my $TopDir = $bpc->TopDir();
-my $BinDir = $bpc->BinDir();
-my %Conf = $bpc->Conf();
+$TopDir = $bpc->TopDir();
+$BinDir = $bpc->BinDir();
+%Conf = $bpc->Conf();
+$Lang = $bpc->Lang();
$bpc->ChildInit();
my @Backups = $bpc->BackupInfoRead($host);
my $numBackups = @Backups;
if ( $numBackups == 0 ) {
- my $subj = "BackupPC: no backups of $host have succeeded";
- sendUserEmail($user, $host, $Conf{EMailNoBackupEverMesg}, $subj, {
+ my $subj = defined($Conf{EMailNoBackupEverSubj})
+ ? $Conf{EMailNoBackupEverSubj}
+ : $Lang->{EMailNoBackupEverSubj};
+ my $mesg = defined($Conf{EMailNoBackupEverMesg})
+ ? $Conf{EMailNoBackupEverMesg}
+ : $Lang->{EMailNoBackupEverMesg};
+ sendUserEmail($user, $host, $mesg, $subj, {
userName => user2name($user)
}) if ( !defined($Jobs{$host}) );
next;
}
}
if ( time - $last > $Conf{EMailNotifyOldBackupDays} * 24*3600 ) {
- my $subj = "BackupPC: no recent backups on $host";
+ my $subj = defined($Conf{EMailNoBackupRecentSubj})
+ ? $Conf{EMailNoBackupRecentSubj}
+ : $Lang->{EMailNoBackupRecentSubj};
+ my $mesg = defined($Conf{EMailNoBackupRecentMesg})
+ ? $Conf{EMailNoBackupRecentMesg}
+ : $Lang->{EMailNoBackupRecentMesg};
my $firstTime = sprintf("%.1f",
(time - $Backups[0]{startTime}) / (24*3600));
my $days = sprintf("%.1f", (time - $last) / (24 * 3600));
- sendUserEmail($user, $host, $Conf{EMailNoBackupRecentMesg}, $subj, {
+ sendUserEmail($user, $host, $mesg, $subj, {
firstTime => $firstTime,
days => $days,
userName => user2name($user),
* 24 * 3600 ) {
my($days, $howLong);
if ( $lastGoodOutlook == 0 ) {
- $howLong = "not been backed up successfully";
+ $howLong = eval("qq{$Lang->{howLong_not_been_backed_up}}");
} else {
$days = sprintf("%.1f", (time - $lastGoodOutlook) / (24*3600));
- $howLong = "not been backed up for $days days";
+ $howLong = eval("qq{$Lang->{howLong_not_been_backed_up_for_days_days}}");
}
- my $subj = "BackupPC: Outlook files on $host need to be backed up";
+ my $subj = defined($Conf{EMailOutlookBackupSubj})
+ ? $Conf{EMailOutlookBackupSubj}
+ : $Lang->{EMailOutlookBackupSubj};
+ my $mesg = defined($Conf{EMailOutlookBackupMesg})
+ ? $Conf{EMailOutlookBackupMesg}
+ : $Lang->{EMailOutlookBackupMesg};
my $firstTime = sprintf("%.1f",
(time - $Backups[0]{startTime}) / (24*3600));
my $lastTime = sprintf("%.1f",
(time - $Backups[$#Backups]{startTime}) / (24*3600));
- sendUserEmail($user, $host, $Conf{EMailOutlookBackupMesg}, $subj, {
+ sendUserEmail($user, $host, $mesg, $subj, {
+ days => $days,
firstTime => $firstTime,
lastTime => $lastTime,
numBackups => $numBackups,
userName => user2name($user),
howLong => $howLong,
+ serverHost => $Conf{ServerHost},
}) if ( !defined($Jobs{$host}) );
}
}
sub sendUserEmail
{
my($user, $host, $mesg, $subj, $vars) = @_;
- $vars->{user} = $user;
- $vars->{host} = $host;
- $vars->{subj} = $subj;
- $mesg =~ s/\$(\w+)/defined($vars->{$1}) ? $vars->{$1} : \$$1/eg;
+ $vars->{user} = $user;
+ $vars->{host} = $host;
+ $vars->{domain} = $Conf{EMailUserDestDomain};
+ $vars->{CgiURL} = $Conf{CgiURL};
+ $subj =~ s/\$(\w+)/defined($vars->{$1}) ? $vars->{$1} : "\$$1"/eg;
+ $vars->{subj} = $subj;
+ $mesg =~ s/\$(\w+)/defined($vars->{$1}) ? $vars->{$1} : "\$$1"/eg;
if ( $opts{t} ) {
print("#" x 75, "\n");
print $mesg;
$Conf{EMailAdminUserName} = '';
#
-# This message is sent to a user if their PC has never been backed up.
-# If your mailer needs a fully-qualified To name, then change "$user"
-# to "$user@mydomain.com" in the template, eg:
+# Destination domain name for email sent to users. By default
+# this is empty, meaning email is sent to plain, unqualified
+# addresses. Otherwise, set it to the destintation domain, eg:
#
-# To: $user@mydomain.com
+# $Cong{EMailUserDestDomain} = '@mydomain.com';
#
-$Conf{EMailNoBackupEverMesg} = <<'EOF';
-To: $user
-cc:
-Subject: $subj
-
-Dear $userName,
-
-Your PC ($host) has never been successfully backed up by our
-PC backup software. PC backups should occur automatically
-when your PC is connected to the network. You should contact
-computer support if:
-
- - Your PC has been regularly connected to the network, meaning
- there is some configuration or setup problem preventing
- backups from occurring.
-
- - You don't want your PC backed up and you want these email
- messages to stop.
-
-Otherwise, please make sure your PC is connected to the network
-next time you are in the office.
+# With this setting user email will be set to 'user@mydomain.com'.
+#
+$Conf{EMailUserDestDomain} = '';
-Regards,
-BackupPC Genie
-http://backuppc.sourceforge.net
-EOF
+#
+# This subject and message is sent to a user if their PC has never been
+# backed up.
+#
+# These values are language-dependent. The default versions can be
+# found in the language file (eg: lib/BackupPC/Lang/en.pm). If you
+# need to change the message, copy it here and edit it, eg:
+#
+# $Conf{EMailNoBackupEverMesg} = <<'EOF';
+# To: $user$domain
+# cc:
+# Subject: $subj
+#
+# Dear $userName,
+#
+# This is a site-specific email message.
+# EOF
+#
+$Conf{EMailNoBackupEverSubj} = undef;
+$Conf{EMailNoBackupEverMesg} = undef;
#
# How old the most recent backup has to be before notifying user.
$Conf{EMailNotifyOldBackupDays} = 7.0;
#
-# This message is sent to a user if their PC has not recently been
-# backed up (ie: more than $Conf{EMailNotifyOldBackupDays} days ago).
+# This subject and message is sent to a user if their PC has not recently
+# been backed up (ie: more than $Conf{EMailNotifyOldBackupDays} days ago).
#
-# If your mailer needs a fully-qualified To name, then change "$user"
-# to "$user@mydomain.com" in the template, eg:
+# These values are language-dependent. The default versions can be
+# found in the language file (eg: lib/BackupPC/Lang/en.pm). If you
+# need to change the message, copy it here and edit it, eg:
#
-# To: $user@mydomain.com
+# $Conf{EMailNoBackupRecentMesg} = <<'EOF';
+# To: $user$domain
+# cc:
+# Subject: $subj
+#
+# Dear $userName,
+#
+# This is a site-specific email message.
+# EOF
#
-$Conf{EMailNoBackupRecentMesg} = <<'EOF';
-To: $user
-cc:
-Subject: $subj
-
-Dear $userName,
-
-Your PC ($host) has not been successfully backed up for $days days.
-Your PC has been correctly backed up $numBackups times from $firstTime to $days days
-ago. PC backups should occur automatically when your PC is connected
-to the network.
-
-If your PC has been connected for more than a few hours to the
-network during the last $days days you should contact IS to find
-out why backups are not working.
-
-Otherwise, if you are out of the office, there's not much you can
-do, other than manually copying especially critical files to other
-media. You should be aware that any files you have created or
-changed in the last $days days (including all new email and
-attachments) cannot be restored if your PC disk crashes.
-
-Regards,
-BackupPC Genie
-http://backuppc.sourceforge.net
-EOF
+$Conf{EMailNoBackupRecentSubj} = undef;
+$Conf{EMailNoBackupRecentMesg} = undef;
#
# How old the most recent backup of Outlook files has to be before
$Conf{EMailNotifyOldOutlookDays} = 5.0;
#
-# This message is sent to a user if their Outlook files have not
-# recently been backed up (ie: more than $Conf{EMailNotifyOldOutlookDays}
+# This subject and message is sent to a user if their Outlook files have
+# not recently been backed up (ie: more than $Conf{EMailNotifyOldOutlookDays}
# days ago).
#
-# If your mailer needs a fully-qualified To name, then change "$user"
-# to "$user@mydomain.com" in the template, eg:
+# These values are language-dependent. The default versions can be
+# found in the language file (eg: lib/BackupPC/Lang/en.pm). If you
+# need to change the message, copy it here and edit it, eg:
#
-# To: $user@mydomain.com
+# $Conf{EMailOutlookBackupMesg} = <<'EOF';
+# To: $user$domain
+# cc:
+# Subject: $subj
+#
+# Dear $userName,
+#
+# This is a site-specific email message.
+# EOF
#
-$Conf{EMailOutlookBackupMesg} = <<'EOF';
-To: $user
-cc:
-Subject: $subj
-
-Dear $userName,
-
-The Outlook files on your PC have $howLong.
-These files contain all your email, attachments, contact and calendar
-information. Your PC has been correctly backed up $numBackups times from
-$firstTime to $lastTime days ago. However, Outlook locks all its files when
-it is running, preventing these files from being backed up.
-
-It is recommended you backup the Outlook files when you are connected
-to the network by exiting Outlook and all other applications, and,
-using just your browser, go to this link:
-
- http://myHost/cgi-bin/BackupPC_Admin?host=$host
-
-Select "Start Incr Backup" twice to start a new incremental backup.
-You can select "Return to $host page" and then hit "reload" to check
-the status of the backup. It should take just a few minutes to
-complete.
-
-Regards,
-BackupPC Genie
-http://backuppc.sourceforge.net
-EOF
+$Conf{EMailOutlookBackupSubj} = undef;
+$Conf{EMailOutlookBackupMesg} = undef;
###########################################################################
# CGI user interface configuration settings
$Conf{CgiAdminUserGroup} = '';
$Conf{CgiAdminUsers} = '';
+#
+# URL of the BackupPC_Admin CGI script. Used for email messages.
+#
+$Conf{CgiURL} = undef;
+
#
# Language to use. See lib/BackupPC/Lang for the list of supported
# languages, which includes English (en) and French (fr). Currently
$Lang{Reason_no_ping} = "no ping";
$Lang{Reason_backup_canceled_by_user} = "backup canceled by user";
+# ---------
+# Email messages
+
+# No backup ever
+$Lang{EMailNoBackupEverSubj} = "BackupPC: no backups of \$host have succeeded";
+$Lang{EMailNoBackupEverMesg} = <<'EOF';
+To: $user$domain
+cc:
+Subject: $subj
+
+Dear $userName,
+
+Your PC ($host) has never been successfully backed up by our
+PC backup software. PC backups should occur automatically
+when your PC is connected to the network. You should contact
+computer support if:
+
+ - Your PC has been regularly connected to the network, meaning
+ there is some configuration or setup problem preventing
+ backups from occurring.
+
+ - You don't want your PC backed up and you want these email
+ messages to stop.
+
+Otherwise, please make sure your PC is connected to the network
+next time you are in the office.
+
+Regards,
+BackupPC Genie
+http://backuppc.sourceforge.net
+EOF
+
+# No recent backup
+$Lang{EMailNoBackupRecentSubj} = "BackupPC: no recent backups on \$host";
+$Lang{EMailNoBackupRecentMesg} = <<'EOF';
+To: $user$domain
+cc:
+Subject: $subj
+
+Dear $userName,
+
+Your PC ($host) has not been successfully backed up for $days days.
+Your PC has been correctly backed up $numBackups times from $firstTime to $days
+ago. PC backups should occur automatically when your PC is connected
+to the network.
+
+If your PC has been connected for more than a few hours to the
+network during the last $days days you should contact IS to find
+out why backups are not working.
+
+Otherwise, if you are out of the office, there's not much you can
+do, other than manually copying especially critical files to other
+media. You should be aware that any files you have created or
+changed in the last $days days (including all new email and
+attachments) cannot be restored if your PC disk crashes.
+
+Regards,
+BackupPC Genie
+http://backuppc.sourceforge.net
+EOF
+
+# Old Outlook files
+$Lang{EMailOutlookBackupSubj} = "BackupPC: Outlook files on \$host need to be backed up";
+$Lang{EMailOutlookBackupMesg} = <<'EOF';
+To: $user$domain
+cc:
+Subject: $subj
+
+Dear $userName,
+
+The Outlook files on your PC have $howLong.
+These files contain all your email, attachments, contact and calendar
+information. Your PC has been correctly backed up $numBackups times from
+$firstTime to $lastTime days ago. However, Outlook locks all its files when
+it is running, preventing these files from being backed up.
+
+It is recommended you backup the Outlook files when you are connected
+to the network by exiting Outlook and all other applications, and,
+using just your browser, go to this link:
+
+ $CgiURL?host=$host
+
+Select "Start Incr Backup" twice to start a new incremental backup.
+You can select "Return to $host page" and then hit "reload" to check
+the status of the backup. It should take just a few minutes to
+complete.
+
+Regards,
+BackupPC Genie
+http://backuppc.sourceforge.net
+EOF
+
+$Lang{howLong_not_been_backed_up} = "not been backed up successfully";
+$Lang{howLong_not_been_backed_up_for_days_days} = "not been backed up for \$days days";
+
#end of lang_en.pm
$Lang{Reason_no_ping} = "pas de ping";
$Lang{Reason_backup_canceled_by_user} = "sauvegarde annulée par l'utilisateur";
+# ---------
+# Email messages
+
+# No backup ever
+$Lang{EMailNoBackupEverSubj} = "BackupPC: aucune sauvegarde de \$host n'a réussi";
+$Lang{EMailNoBackupEverMesg} = <<'EOF';
+To: $user$domain
+cc:
+Subject: $subj
+
+$userName,
+
+Notre logiciel de copies de sécurité n'a jamais réussi à
+prendre de sauvegarde de votre ordinateur ($host). Les sauvegardes
+devraient normallement survenir lorsque votre ordinateur est connecté
+au réseau. Vous devriez contacter le support informatique si:
+
+ - Votre ordinateur est régulièrement connecté au réseau, ce qui
+ signifie qu'il y aurait un problème de configuration
+ empêchant les sauvegardes de s'effectuer.
+
+ - Vous ne voulez pas qu'il y ait de copies de sécurité de
+ votre ordinateur ni ne voulez recevoir d'autres messages
+ comme celui-ci.
+
+Autrement, veuillez vous assurer que votre ordinateur est connecté
+au réseau lorsque ce sera possible.
+
+Merci de votre attention,
+BackupPC Genie
+http://backuppc.sourceforge.net
+EOF
+
+# No recent backup
+$Lang{EMailNoBackupRecentSubj} = "BackupPC: auncune sauvegarde récente de \$host";
+$Lang{EMailNoBackupRecentMesg} = <<'EOF';
+To: $user$domain
+cc:
+Subject: $subj
+
+$userName,
+
+Aucune sauvegarde de votre ordinateur n'a été effectuée depuis $days
+jours. $numBackups sauvegardes ont étés effectuées du $firstTime
+jusqu'il y à $days jours. Les sauvegardes devraient normallement
+survenir lorsque votre ordinateur est connecté au réseau.
+
+Si votre ordinateur a été connecté au réseau plus de quelques heures
+durant les derniers $days jours, vous devriez contacter votre support
+informatique pour savoir pourquoi les sauvegardes ne s'effectuent pas.
+
+Autrement, si vous êtes en dehors du bureau, il n'y a pas d'autres
+choses que vous pouvez faire, à part faire des copies de vos fichiers
+importants sur d'autres media. Vous devez réaliser que tout fichier crée
+ou modifié durant les $days derniers jours (incluant les courriels et
+les fichiers attachés) ne pourra être restauré si une problème survient
+avec votre ordinateur.
+
+Merci de votre attention,
+BackupPC Genie
+http://backuppc.sourceforge.net
+EOF
+
+# Old Outlook files
+$Lang{EMailOutlookBackupSubj} = "BackupPC: Les fichiers de Outlook sur \$host doivent êtes sauvegardés";
+$Lang{EMailOutlookBackupMesg} = <<'EOF';
+To: $user$domain
+cc:
+Subject: $subj
+
+$userName,
+
+Les fichiers Outlook sur votre ordinateur n'ont $howLong. Ces fichiers
+contiennent tous vos courriels, fichiers attachés, carnets d'adresses et
+calendriers. $numBackups sauvegardes ont étés effectuées du $firstTime
+au $lastTime. Par contre, Outlook bloque ses fichiers lorsqu'il est
+ouvert, ce qui empêche de les sauvegarder.
+
+Il est recommendé d'effectuer une sauvegarde de vos fichiers Outlook
+quand vous serez connecté au réseau en quittant Outlook et tout autre
+application, et en visitant ce lien avec votre fureteur web:
+
+ $CgiURL?host=$host
+
+Choisissez "Démarrer la sauvegarde incrémentale" deux fois afin
+d'effectuer une nouvelle sauvegarde. Vous pouvez ensuite choisir
+"Retourner à la page de $host" et appuyer sur "Recharger" dans votre
+fureteur avec de vérifier le bon fonctionnement de la sauvegarde. La
+sauvegarde devrait prendre quelques minutes à s'effectuer.
+
+Merci de votre attention,
+BackupPC Genie
+http://backuppc.sourceforge.net
+EOF
+
+$Lang{howLong_not_been_backed_up} = "jamais étés sauvegardés";
+$Lang{howLong_not_been_backed_up_for_days_days} = "pas été sauvegardés depuis \$days jours";
#end of lang_fr.pm