dlevens Posted July 11, 2004 Share Posted July 11, 2004 I want to backup and compress just one directory and all files inside it. Through cpanel I only have two choices, either backup everything or backup my entire homefolder. Anyone know how I can backup just one folder? I tried playing with gzip and tar but not sure what command to run to make this happen. Dennis Quote Link to comment Share on other sites More sharing options...
jandafields Posted July 17, 2004 Share Posted July 17, 2004 If this is just for every once in a while, you could ftp the directory to your computer and zip it up from there. Or, if you want the server to do it, run the following commands with a cron job or whatever: This archives all the files in the dir into one file, and compresses the new file: >tar -czvf /home/user/output_filename.tgz /home/user/public_html/whatever_dir/ Notice the output file comes first, and the dir to be compressed is second in the command. Quote Link to comment Share on other sites More sharing options...
dlevens Posted July 17, 2004 Author Share Posted July 17, 2004 ahh, thats why it kept failing for me. Linux is so backwards or is it Windows is so backwards? hehe Thanks Janda, your like my personal trainer on these forums. Dennis Quote Link to comment Share on other sites More sharing options...
jandafields Posted July 17, 2004 Share Posted July 17, 2004 No problem. Glad to be of assistance. By the way, my name is Josh. Janda is actually "J and A" Quote Link to comment Share on other sites More sharing options...
dlevens Posted July 17, 2004 Author Share Posted July 17, 2004 ahh, makes sense, mr. Fields I presume? Dennis Quote Link to comment Share on other sites More sharing options...
Road Runner Posted July 17, 2004 Share Posted July 17, 2004 Great! I was looking for a solution to this. Just one question. This error message appeared at the end of the email: tar: Error exit delayed from previous errors Any idea what it means? The archive tested fine and when I unzipped it, the structure and files appeared to be fine also. I just don't understand why I got the error message. Quote Link to comment Share on other sites More sharing options...
jandafields Posted July 18, 2004 Share Posted July 18, 2004 ahh, makes sense, mr. Fields I presume? You presume correctly. Quote Link to comment Share on other sites More sharing options...
jandafields Posted July 18, 2004 Share Posted July 18, 2004 This error message appeared at the end of the email:tar: Error exit delayed from previous errors Any idea what it means? What was your exact command? Did you run this from a cronjob? If not, then where? Quote Link to comment Share on other sites More sharing options...
dlevens Posted July 18, 2004 Author Share Posted July 18, 2004 I got the same error. I ran from cron and also ran via php script. Both gave the same error. I assume it means one or more files it did not have access to. I have one file in on of my directories owned by root and it never appears in my backups. So I assume the error was from that. Dennis Quote Link to comment Share on other sites More sharing options...
Road Runner Posted July 20, 2004 Share Posted July 20, 2004 What was your exact command? Did you run this from a cronjob? If not, then where? I must have notifications turned off and I haven't visited this forum since this post ... that's obvious. Yes via a cron job, set to run only once. The command was: >tar -czvfp /home/user/backup.tar.gz /home/user/public_html/gallery/ Quote Link to comment Share on other sites More sharing options...
jandafields Posted July 20, 2004 Share Posted July 20, 2004 why did you add the "p" option for? Quote Link to comment Share on other sites More sharing options...
jandafields Posted July 20, 2004 Share Posted July 20, 2004 Nevermind about the "p" option. It is fine. Anyway, you possibly have some files owned by "nodody" that are not readable by everybody. These were probably created by the gallery program. If your userid doesn't have access to at least read those files, then they cannot be backed up. That's probably the case because Gallery does that to the data files for security purposes. You will need to either change the permissions on those files, or run the tar command under the user "nobody". Quote Link to comment Share on other sites More sharing options...
Road Runner Posted July 20, 2004 Share Posted July 20, 2004 Guess I'll go through the files one by one. btw, for future reference. How would I go about running the command under the user "nobody"? Thanks for all your help! Quote Link to comment Share on other sites More sharing options...
TCH-Bruce Posted July 20, 2004 Share Posted July 20, 2004 btw, for future reference. How would I go about running the command under the user "nobody"? You cannot specify a user to run a cron job under. Quote Link to comment Share on other sites More sharing options...
djgizmo Posted September 30, 2004 Share Posted September 30, 2004 Whats the difference between the TAR and GZIP commands? From what I'm understanding, gzip is to compress single or multiple mentioned files and TAR is to blanket a directory correct? Please explain... Thanks Also, if I would run the above script via cron weekly, would it auto-overwrite the .tgz file? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.