Downaload SpeedyCGI 2.22 Source Code
tar -zxvf CGI-SpeedyCGI-2.22.tar.gz
cd CGI-SpeedyCGI-2.22
/usr/perl5/5.8.4/bin/perlgcc Makefile.PL (Answer No)
make (Forget any error message)
make test
make install
cd /usr/bin
ln -s /usr/perl5/5.8.4/bin/speedy
cp /usr/bin/speedy /usr/bin/speedy_suid
chmod 4555 /usr/perl5/5.8.4/bin/speedy
[ 發表回應 ] ( 22預覽 ) | 常註連結 | ( 3 / 2179 )
# zfs-backup.pl
#!/usr/bin/perl
### Design By Andrew Choi
### Backup Directory
@backuppool = ("ntpool/u0","ntpool/local");
$targetpool = "backup";
$record = "/$targetpool/zfs-backup-record.dat";
### Main Program
# Gen Date Code
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime time;
$year = $year + 1900;
$mon = substr "0".$mon,-2;
$mday = substr "0".$mday,-2;
$hour = substr "0".$hour,-2;
$min = substr "0".$min,-2;
$sec = substr "0".$sec,-2;
$datecode = $year.$mon.$mday.$hour.$min.$sec;
# Check the last record of record file
open (FILE,"<$record");
@temp = <FILE>;
close (FILE);
$lastrecord = pop(@temp);
chop ($lastrecord);
# Save the update datecode
open (FILE,">>$record");
print FILE"$datecode\n";
close (FILE);
# Create snapshot
foreach $pool(@backuppool) {
$command = "zfs snapshot $pool\@$datecode\n";
print $command;
$a = `$command`;
}
# Backup method
if ($lastrecord eq "") {
# Full Backup
foreach $pool(@backuppool) {
$command = "zfs send $pool\@$datecode \| zfs recv -F $targetpool/$pool\n";
print $command;
$a = `$command`;
}
} else {
# Incremental Backup
foreach $pool(@backuppool) {
$command = "zfs send -i $pool\@$lastrecord $pool\@$datecode \| zfs recv -F $targetpool/$pool\n";
print $command;
$a = `$command`;
}
}
# clean-snapshot.pl
#!/usr/bin/perl
### Design By Andrew Choi
### Clean snapshot
@backuppool = ("ntpool/u0","ntpool/local");
$targetpool = "backup";
$record = "/$targetpool/zfs-backup-record.dat";
### Main Program
# Check the last record of record file
open (FILE,"<$record");
@temp = <FILE>;
close (FILE);
if ($temp[0] eq "") {print "No any snapshot for clean\n"; exit;}
# Clean snapshot method
foreach $datecode(@temp) {
chop ($datecode);
foreach $pool(@backuppool) {
$command = "zfs destroy $pool\@$datecode\n";
$a = `$command`;
print $command;
$command = "zfs destroy $targetpool/$pool\@$datecode\n";
$a = `$command`;
print $command;
}
}
# Remove the record file
$command = "rm $record\n";
print $command;
$a = `$command`;
[ 發表回應 ] ( 19預覽 ) | 常註連結 | ( 2.8 / 1715 )
DON'T USE :-
perl Makefile.PL
USE :-
/usr/perl5/bin/perlgcc Makefile.PL
[ 發表回應 ] ( 13預覽 ) | 常註連結 | ( 2.9 / 1609 )
#!/usr/bin/perl
### Design By Andrew Choi
### Backup Directory
$backupdir = "/etc /u0 /usr/local/mysql /usr/local/apache2/conf /var/spool/cron/crontabs";
$targetdir = "/backup131/files/";
$incremental_recode = $targetdir."data-backup-record";
$tar = "/usr/local/bin/tar";
### Main Program
# Gen Date Code
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime time;
$year = $year + 1900;
$mon = substr "0".$mon,-2;
$mday = substr "0".$mday,-2;
$hour = substr "0".$hour,-2;
$min = substr "0".$min,-2;
$sec = substr "0".$sec,-2;
$datecode = $year.$mon.$mday.$hour.$min.$sec;
# Run Backup
$command = $tar." zcvf ".$targetdir.$datecode."-incremental-data-backup.tar.gz -g ".$incremental_recode." ".$backupdir;
print $command."\n";
$a = `$command`;
[ 發表回應 ] ( 19預覽 ) | 常註連結 | ( 3 / 1731 )