backup ..tar..gzip
wolli
- cgi
Hallo Leute,
möchte gerne regelmäßig ein backup meines webspaces machen.
hab dazu ein script gefunden welches die Daten auf dem Webspeicherplatz mit tar gzip packt.
Dummerweise habe ich aber keinen Zugriff auf gzip + tar
der Provider hat diese progs gesperrt und schaltet diese auch nicht frei.
zip kann ich jedoch nutzen :-)
Hat jemand eine Idee wie man das folgende backupscript so umbaut,
dass es nicht tar und gzip, sondern zip verwendet ??
Danke für Eure Hilfe
Gruss
wolli
Hier der Code
#!/usr/local/bin/perl
$version = '1.0';
#########################################################################################
# #
# #
# #
# Requirement: Hypermart: #
# #
# #
# #
# #
# directories): #
$tar_loc = '/bin/tar';
$gzip_loc = '/usr/contrib/bin/gzip';
$dir = '/data1/hypermart.net/yourname';
$output = '/data1/hypermart.net/yourname/a_dir_chmoded_to_777/yourname-bk.tar.gz';
$htmlout = 'http://yourname.hypermart.net/a_dir_chmoded_to_777/yourname-bk.tar.gz';
$tar_temp = '/data1/hypermart.net/htmlcrawler/a_dir_chmoded_to_777/bk.tar';
# download them. #
# #
# #
# #
#########################################################################################
print qq!Content-type: text/html
<html>
<head>
<title>site compression</title>
</head>
<body>
<blockquote>
<font size="2" face="arial"><b>gz-site $version</b></font><br><br>
!;
unlink("$output");
open(TAR, "$tar_loc cf $tar_temp $dir/* |");
print qq!<font size="2 face="arial"><b>1.</b>wrote tar file [ </font>
<font size="1" face="arial">$tar_temp</font>
<font size="2 face="arial"> ]</font>
!;
close(TAR);
print qq!<form>
<font size="2 face="arial"><b>2.</b> test tar file [ </font>
<font size="1" face="arial">$tar_temp</font>
<font size="2 face="arial"> ] : </font><br>
<select name="">
!;
open (EXE, "$tar_loc tf $tar_temp |");
@data=<EXE>;
close(EXE);
foreach $file (@data)
{
print "<option value="">$file<option>\n";
}
open(GZ, "$gzip_loc -c $tar_temp > $output |");
print qq! </select><br><br>
<font size="2 face="arial"><b>3.</b> wrote gzip [ </font>
<font size="1" face="arial">$output</font>
<font size="2 face="arial"> ]</font><br><br>!;
close(GZ);
unlink("$tar_temp");
print qq!<font size="2 face="arial"><b>4.</b> delete temp tar file [ </font>
<font size="1" face="arial">$tar_temp</font>
<font size="2 face="arial"> ]</font><br><br>!;
print qq!<font size="2 face="arial"><b>5.</b> download gzip file [ </font>
<font size="1" face="arial"><a href="$htmlout">$htmlout</a></font>
<font size="2 face="arial"> ]</font><br>!;
print qq!
<br><br>
<center><font size="1" face="arial,veranda">
<a href="http://skidmore.hypermart.net/scripts/cgi/gz-site/">gz-site</a> $version -- (c) skidco, 1999
</font></center>
</body>
</html>!;
Hi,
möchte gerne regelmäßig ein backup meines webspaces machen.
wieso postest Du das dann unter CGI?
Das ist doch ziemlich sicher keine Aufgabe, die man über CGI erledigen
sollte.
Ein Programm, das über die CGI-Schnittstelle aufgerufen wird, sollte
keine nennenswerte CPU-Last auf dem Server erzeugen und wird deshalb
nach Erreichen des CGI-Timeouts abgebrochen.
Außerdem möchtest Du die Sicherung doch nicht jedes Mal manuell starten
müssen?
Für Deine Aufgabenstellung wäre ein cron-Job wesentlich sinnvoller.
Dummerweise habe ich aber keinen Zugriff auf gzip + tar
der Provider hat diese progs gesperrt und schaltet diese auch nicht frei.
Herzlichen Glückwunsch zu Deiner Leidensfähigkeit, bei diesem Provider
zu bleiben. Ich würde Dein Problem anders lösen.
GZ-SITE v1.0 (beta)
Eieiei! Du verwendest eine Beta-Version eines Skripts, das Du nicht
verstehst, und willst diese anpassen? Na, dann mal viel Spaß ...
(c) SkidCo/Josh Skidmore 1998-99
skidmore@musc.edu
http://skidmore.hypermart.net/scripts/cgi/gz-site/
Das ist der Autor des Skripts, den Du danach fragen solltest.
Viele Grüße
Michael
P.S.: </faq/#Q-08>