Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am using pax to backup my files and need to exclude a couple of large files. The file names never change.
From reading the man pages i should use the -c operator but it doesn't give any examples. this is my best guess but it says i am using a invaild combination of w c and f
pax -w -f test /root/code_samples -c /root/code_samples/phpMyAdmin-2.6.2.zip
I think pax could turn out to be a nice little gem and may have to check it out some more.
The man page can be a bit confusing for sure but here is an excellent article. The -c option is on page three and is used like this.... -c './Linux Stuff' where that is the directory which I don't want restored. http://www.onlamp.com/pub/a/bsd/2002...cs.html?page=1
Here is an example I used.
Code:
# ls
Linux Stuff Linux Technical Docs
# I cd into the Linux directory and make a backup file called backup
pax -wf /home/backup .
# Now I want to restore everything exept the directory called "Linux Stuff"
# In this example, I'll restore to /home/images for testing purposes.
cd /home/images
pax -rvf /home/backup -c './Linux Stuff'
Don't forget to use single quotes on the file or directory to exclude from the restore.
That's what I gather so far. I'll have to do some more checking to see what other options there are but I don't think -c is used during save operations.
what i want to do it to backup a users site into a single file and then offer it back to them so that they can download it and save it. (Basically so they are ultimately responsible for the data and not me)
My users like many others are a bit thick and we have advertised as a 'no extra software required' websites. So i would like to avoid using a FTP client. It would be great if the user just clicks a link and off they go.
Therefore i thought if i can backup /home/website1 and then copy that file to /home/website1/backup the users can download from /home/website1/backup directly (obviously with sufficent authentication)
This leads to the problem that the next time the backup is run it will backup the backup. Because the user is downloading the backup file it is vital that it is as small as possible.
the man reason i am doing this is because one of my users deleted all the products out of the database then phoned me asking what the undo command was. He wasn't happy when i said there wasn't one. I did have a backup but it was before he added 400 products, again he wasn't happy.
Okay this is involved but not too complicated. The find command is going to find every single file in their directory. It will pass that to the grep command, which will remove the lines which match the pattern of the file you don't want (use the whole name and path -- look at the find output to determine what this is -- to make sure you get only it). The grep command pipes all those filenames to pax... which writes an archive. The -d flag is what is important. It tells pax to match directories but not all the files beneath it. Basically, it says "only archive what I specifically name". In this case I use ustar as my format but you can use whichever makes sense for your users and is supported. I also pass it through bzip2 to compress it as well. This may or may not work for you (if you don't think your users will have bunzip2 or access to a program that will handle it).
Note, you could pass each user's directory as an argument and just assign it to DIRECTORY, or you could modify this script to step through each one... and do this for each. But it gives you the basic idea.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.