pj4ever Posted December 10, 2002 Posted December 10, 2002 I want to know how to backup the entire OSCommerce catalog and admin in case something happens. Does anyone know of anyway(s) to do this kind of backup, plus retaining the original file permission? I current does not have telnet access, so I can't go to the shell to create a tar or gzip it. Please help! Patrick
Guest Posted December 12, 2002 Posted December 12, 2002 I wrote a cgi script to accomplis this on my UNIX server. Make sure you set the PATH for PERL on the top line. Read the code. I could not get variables to work in my system calls so you make need some changes. Change the ArcDir and Catalog near the top. #!/usr/bin/perl $ArcDir = "/your/path/here/Archive"; # folder for backup files # change this as needed to $Catalog = "/your/home/directory"; # root dir of catalog # -------------------------------------------------- print("Content-Type: text/plainnn"); print "Archiving catalog to $ArcDir/cat.tar.gz.nn"; open(DATA, ">$ArcDir/test.txt"); print DATA "a testn"; close(DATA); if(open(DATA, "$ArcDir/test.txt")) { $_ = <DATA>; close(DATA); if($_ eq "a testn") { print "Archive Write Passed.nn"; `rm $ArcDir/test.txt`; print "Creating Tar file.nn"; system('cd $Catalog;tar cvf cat.tar catalog > Archive/backup.txt'); print "Zipping Tar file.nn"; system('cd $Catalog; gzip cat.tar'); print "Moving Tar.gz file to Archive folder.nn"; system('cd $Catalog;mv cat.tar.gz Archive'); } else { print "Archive Write Failed. But not same data.nn"; `rm $ArcDir/test.txt`; } } else { print "Archive Write Failed. File could not be created.nn"; } print "Archive is now Complete.nn"; exit 0; You can run this from a browser http://yourdomain/scriptname Hope this helps.
mattice Posted December 12, 2002 Posted December 12, 2002 You can run this from a browserhttp://yourdomain/scriptname Small correction: http://www.yoursite.com/cgi-bin/scriptname.pl If the .pl extention doesn't work change it to .cgi Regards, Matthijs "Politics is the art of preventing people from taking part in affairs which properly concern them"
Guest Posted December 12, 2002 Posted December 12, 2002 Good idea mattice. My hosting does not restrict me to running scripts from the cgi-bin directory so I did not list it in my reply. The script also assumes you have created the directory Archive and it is writable. It also assumes your catalog is in the directory named catalog. I am not perl or php expert, just trying to help out a bit. I will keep in mind the typical settings on most servers. Thanks
mattice Posted December 12, 2002 Posted December 12, 2002 I am not perl or php expert, just trying to help out a bit. And that is appreciated! Just thought I'd mention it as most providers will only allow you to run perl scripts from the cgi-bin. And for anybody using this... it assumes you have access to both tar and gzip using the system() command which might not be the case.... "Politics is the art of preventing people from taking part in affairs which properly concern them"
networkdad Posted December 14, 2002 Posted December 14, 2002 I highly recommend installing Gossamer's Filemanager - It offers nearly everything you could do from a shell or telnet, in the form of GUI using cgi. It works well - You can TAR files, unzip, etc. - It's free!
Recommended Posts
Archived
This topic is now archived and is closed to further replies.