Hi,
when executing the backup sub I get a 500. Why??? The backup file is created corectly, however the counter file doesn't save the new value.
Thank you for the help!
sub html_backup_db {
$n=0;
$c=10;
#####--Change the number after $c above to the number of backups you would like (currently set for 10 backups).
#####--CREATE A BLANK COUNTER FILE, whose name will be inserted below.
#####--If you are making several backup routines, make sure the counter files have
#####--different names.
#####--Change the path below after NUM, to the full path and name of your counter file.
open (NUM, $db_BackupCounter) or &cgierr ("unable to open $db_BackupCounter. reason: $!");
$n=<NUM>;
if ($n<$c) {++$n;}
else {$n=1}
print $n;
#####--Change the path below after TEST, to the full path and name of you counter file.
#####--Should be the same file name as above.
open (TEST, ">$db_BackupCounter");
print TEST $n;
close TEST;
close NUM;
#####--Change the path below after DAT, to the full path and of the file you want backed up.
open (DAT, $db_file_name) or &cgierr ("unable to open $db_file_name. reason: $!");
#####--Change the path below after DATTMP, to the full path and name
#####--of the backup files (you can change the file name, but leave the $n -- it will
#####--return the backup count).
open (DATTMP, ">$db_Backup$n") or &cgierr ("unable to open $db_Backup/$_. reason: $!");
while (<DAT> ) {
print DATTMP;
}
close DAT;
close DATTMP;
}
Jakob
when executing the backup sub I get a 500. Why??? The backup file is created corectly, however the counter file doesn't save the new value.
Thank you for the help!
sub html_backup_db {
$n=0;
$c=10;
#####--Change the number after $c above to the number of backups you would like (currently set for 10 backups).
#####--CREATE A BLANK COUNTER FILE, whose name will be inserted below.
#####--If you are making several backup routines, make sure the counter files have
#####--different names.
#####--Change the path below after NUM, to the full path and name of your counter file.
open (NUM, $db_BackupCounter) or &cgierr ("unable to open $db_BackupCounter. reason: $!");
$n=<NUM>;
if ($n<$c) {++$n;}
else {$n=1}
print $n;
#####--Change the path below after TEST, to the full path and name of you counter file.
#####--Should be the same file name as above.
open (TEST, ">$db_BackupCounter");
print TEST $n;
close TEST;
close NUM;
#####--Change the path below after DAT, to the full path and of the file you want backed up.
open (DAT, $db_file_name) or &cgierr ("unable to open $db_file_name. reason: $!");
#####--Change the path below after DATTMP, to the full path and name
#####--of the backup files (you can change the file name, but leave the $n -- it will
#####--return the backup count).
open (DATTMP, ">$db_Backup$n") or &cgierr ("unable to open $db_Backup/$_. reason: $!");
while (<DAT> ) {
print DATTMP;
}
close DAT;
close DATTMP;
}
Jakob