Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
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.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I have a backup script here at work on a server that will backup whats needed from the server to an external drive. Now everything works great but there are a few things Id like to build into it but have no clue how. This isnt my script (its a past employees) all I have done is minor modifications as needed. The two things I would like to do is this...
This is after a full system backup has already been made nd will run once a day.
1) If a file gets deleted from the server then delete it from the external drive.
2) If a file is updated on the server then update on the external drive.
3) If possible perhaps alter the script to run something that ONLY updates the external (delete files or update them)as to what ever changes have been made to the server.
Is any of this possible and if so how could I do it. Like I said I have never done any kind of programming on linux or any heavy commands, so help on this would be greatly appreciated. Here is the script I have now to JUST run a back up.
mount /dev/sdb1 /mnt/backup
tar -cvf /mnt/backup/etc.tar etc
tar -cvf /mnt/backup/scooter.tar /u /var/www /d2a /etc /home /var/lib/mysql backup backup1
cp /data/* /mnt/backup
cp backup /mnt/backup
cp backup1 /mnt/backup
mount win2:/ /win2 -o rsize=1024,wsize=1024
tar -cvf /mnt/backup/win2.tar /win2/u /win2/var/www /win2/etc
ls -al /mnt/backup
echo Done with Backup
all you really need is rsync it does wonders really
it synchronizes folders and files and if the is no changes it wont do anything
mount /dev/sdb1 /mnt/backup
rsync -vaz --delete --exclude="folder1" --exclude="folder2" /the/folder/ /destination/
exclude the folder u dont want to backup add what you want basically this is just a guide on
what you should use
Aside from your stress level going up, this is one of the best ways to get involved. Assuming your being in a Linux forum this script is written in bash. So, I would suggest you need a bash scripting guide, regardless of your level of experience. O'Reilly's guide is good, and Linux Shell Scripting With Bash by Ken O. Burtch Prentice/Hall is pretty good, too.
I strongly suggest that you write stub code (a script or program that accomplishes one thing, as a teaching tool) to try out one idea, and then incorporate into the main script. If you start by tackling individual pieces and posting those questions, helping you could be managed better, IMHO. Let's take your deleting a currently deleted file from the backup drive.
Are you wanting to delete that file from a tar archive? I suppose it could be done by looking for the file using tar t; unpacking the tar file in a sandbox; deleting the file; and making a tar file of what's left.
Last edited by cmnorton; 03-26-2008 at 10:45 AM.