We have a Perl script that is supposed to back up all our files, folders and databases on our server however its sending an error via email. This is the error
Unrecognized character \xA6 at /home/onehosts/cronjob/backup.pl line 45.
This is the script
[code=perl]
#!/usr/bin/perl
#### CONFIG ####
$BackupHour = 3; # TIME TO RUN THE BACKUP
$BackupPath = "/home/onehosts/cronjob/"; #This is the folder where your backup file set file is stored
$BackupFileName = "backup.tar.gz" ; #The name you want to give to your tar file
$BackupFileList = "file_list.txt" ; #The list that you use to determine what parts to back up
$HostHasMySQL = 1; # 1 = YES, 0 = NO
$MySQLRootPassw ord = 'jo5765';
$MySQLBackupFil eList = "mysql_list.txt "; #The list that you use to determine which databases to backup.
############### #
($sec,$min,$hou r,$mday,$mon,$y ear,$wday,$yday ,$isdst) = localtime(time) ;
if ($hour == $BackupHour) {
if ($HostHasMySQL == 1) {
&DumpDatabas es;
}
&BackupFiles ;
}
#### SUBS ####
sub BackupFiles
{
# remove old backup file
$systemresult = system("rm $BackupPath\/$BackupFileName ");
# create .tar.gz file
$systemresult = system("tar czvf $BackupPath\/$BackupFileName -T $BackupPath\/$BackupFileList \&>\/dev\/null");
}
sub DumpDatabases
{
my $name;
if (open(DBLIST, "$BackupPat h\/$MySQLBackupFil eList")) {
while (<DBLIST>) {
if (/^\s*\#/ ¦¦ /^\s*$/) {
# Ignore Comments and Blank Lines
} elsif ( /^\s*([\w]+)\s*/ ) {
$name = $1;
$systemresult = system("mysqldu mp --opt --user=onehosts_t hirsty --password=$MySQL RootPassword $name > $BackupPath$
}
}
close (DBLIST);
}
}
[/code]
Thanks for the help!
Unrecognized character \xA6 at /home/onehosts/cronjob/backup.pl line 45.
This is the script
[code=perl]
#!/usr/bin/perl
#### CONFIG ####
$BackupHour = 3; # TIME TO RUN THE BACKUP
$BackupPath = "/home/onehosts/cronjob/"; #This is the folder where your backup file set file is stored
$BackupFileName = "backup.tar.gz" ; #The name you want to give to your tar file
$BackupFileList = "file_list.txt" ; #The list that you use to determine what parts to back up
$HostHasMySQL = 1; # 1 = YES, 0 = NO
$MySQLRootPassw ord = 'jo5765';
$MySQLBackupFil eList = "mysql_list.txt "; #The list that you use to determine which databases to backup.
############### #
($sec,$min,$hou r,$mday,$mon,$y ear,$wday,$yday ,$isdst) = localtime(time) ;
if ($hour == $BackupHour) {
if ($HostHasMySQL == 1) {
&DumpDatabas es;
}
&BackupFiles ;
}
#### SUBS ####
sub BackupFiles
{
# remove old backup file
$systemresult = system("rm $BackupPath\/$BackupFileName ");
# create .tar.gz file
$systemresult = system("tar czvf $BackupPath\/$BackupFileName -T $BackupPath\/$BackupFileList \&>\/dev\/null");
}
sub DumpDatabases
{
my $name;
if (open(DBLIST, "$BackupPat h\/$MySQLBackupFil eList")) {
while (<DBLIST>) {
if (/^\s*\#/ ¦¦ /^\s*$/) {
# Ignore Comments and Blank Lines
} elsif ( /^\s*([\w]+)\s*/ ) {
$name = $1;
$systemresult = system("mysqldu mp --opt --user=onehosts_t hirsty --password=$MySQL RootPassword $name > $BackupPath$
}
}
close (DBLIST);
}
}
[/code]
Thanks for the help!
Comment