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.
Well, if you don't know how to write a script then maybe it's time to look for a new job
The short answer is: A script is simply a list of commands in a text file that are executed one after the other.
The only condition is that the file have executable permissions.
Take a look at the Advanced Bash-Scripting Guide. There is tons of info on there. Also open up your favourite IRC client and go to #bash on irc.freenode.net
This isn't really the right forum for a question. You should have posted it in the newbies section, so don't be surprised if a moderator moves it there.
You didn't indicate which distro you are using and what hardware is used to make backups.
Normally the tar command is used to produce the backups and often the find command is used to locate files more recent than the latest backup. If you want the backup script to be run automatically, then you will probably want to write a cron script.
If you use access control lists, then read the documentation for your version of the tar command. You may need to use the star command instead. It is similar to tar but can also backup the acl lists associated with the file. ( see the man page for getfacl and setfacl. ) If setfacl and getfacl aren't installed then you don't use them.
If you will be backing up to DVD, look into dar and kdar. Dar stands for disk archiver. It writes backups into slices which can be CDROM or DVD size segments. The kdar program is a graphical interface to dar. It allows you to easily configure what you want to be backed up, and the type of backup. For example, once a month, you might perform a total backup, and then have another job to perform incremental backups. Using kdar, you can export the job as a bash script and use that script as your cron executed script.
Another advantage of using dar or kdar is that it tracks files that have been deleted since the last backup. So suppose that an emergency happens and you need to restore the system, starting from the initial full backup, and then each incremental backup. If you deleted a file between the 2nd & 3rd backup, restoring from the 3rd backup, dar will delete that file. This way you don't end up with a bunch of obsolete file orphans that you don't want.
First, you need to know from your boss the following..
1. Whether you want to take the back of only those files created or modified on that day or you want to take the full system file backup like compressing the entire files under / directory..??
2. Read the book Begining linux programming 3 rd edition...i think e-book is available on the net. There try the shell scripting chapter..
3. Then, you make a complete study on the date command, tar command and also how to start your script at the startup.
So, the concept is, you need to start your script at the startup, check the date and time continuosly, when the desired time arrives, run the script files automatically which backup the system files...
Distribution: RHEL 4 and up, CentOS 5.x, Fedora Core 5 and up, Ubuntu 8 and up
Hmm, well funny story is I never touched Linux and my boss expected the same. I was lucky though he taught me everything and I "self taught" my self as I went a long. Scripting is fairly easy but can be tough to get into because you don't know where to start.....
1) you will need to go through some basic bash and shell scripting tutorial as mentioned by the others
2) is the backup script for a linux box, windows box or mac? i would assume linux.
3) like the other LQ memeber said, what is it you want to backup? for exmaple if you have 5 users on the linux system, do you want to backup all 5 users or just 2? i would hope all 5. next thing is what do you want to backup from each user..... once you know the criteria for your backup you should be good to go for writing the script.
4) to write a script first write out your plan (for beginners, its called pseudo code)
so lets say i want to copy files from user johnny on my linux box to the backup directory which you will need to create (so you have to make a directory called /home/backup. now i want to back up johnnys documents which are stored in /home/johnny/documents. so you know your first line of code has to copy the directory /home/johnny/documents/*. the star is a wild card so any and all files will copy over to the backup directory. once you have copied the files over then you should compress them, not once but twice, use a tarball and then gzip. once they are compressed you can delete the old backup directory /home/backup/johnny/documents thus removing the un-needed files which have been compressed in to a tar.gz file to save space (if you ever need to go to the backup you just uncompress the tar.gz file which will recreate johnny/documents). now to be safe i would take a copy of the compressed backup file and copy it to another machine, preferable another linux box. if you don't have one then maybe use an external USB drive or you can map to a windows box (you would have to create a share on the windows box you want to backup to).
you should create a log file to so that you can see your backup steps, can help you with that as well - once your there.
you will need to maintain and control your backup files you will want to keep a cycle of them to prevent them from taking up a tone of space. lets say 2 weeks worth, 14 days. you will need to create a script for this to - more advanced but i can explain once we get the first script done. basically you create an automated script to remove files older than 14 days thus keeping 14 days worth of backups on your server.
now that you have the plan you can write the script
5) writing the script - once you get here i can help
Now what the other guys say about you getting a new job well that might be true, but why the heck would your boss ask you to do this if he knows you cant? i dont think we (LQ memebers) are getting the full story....