![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Updated Backups for Digital Collections DC-3 systems You can purchase backup software with GUI interfaces, however, Unix provides built-in methods to do the same function. On HP-UX, you can use fbackup or tar commands to back up data to streaming media. In Red Hat Linux, the fbackup command does not exist. But not to fret, because tar works well, too. Here's the code for a shell script that you'll need to backup a filesystem with tar on Red Hat Linux 6.2: #!/bin/sh The tar command is used here with the cvf switches. Here's what those commands do: c - create a new archive The /dev/st0 command tells tar where to store this tarfile. BE CAREFUL with this path. On our system, this points to a SCSI tape drive, but you can point it to any device you want. Just remember that if you type it incorrectly (that last character is a zero, not an oh) you could be saving all that data to a file on your system and it could fill up a filesystem in a matter of minutes. That would be very bad. /filesystem is the filesystem we want to back up. -L is the length of the tape (change tapes after writing N*1024 bytes) The pipe symbol (also known as the vertical bar) is a unix command that allows you to combine multiple commands; here we want to create a log file of what's going on tape so we can double-check to make sure the data we want is being archived to tape. tee - reads from standard input and writes to standard output and files The path that follows (/backups/backup.log) is the filename and path we want to store the log file in. Automation using Cron If you want to back up your files automatically each day, you can use the cron utility in Unix to schedule it. First, make a file that contains the command you wish to run; in this case the file would contain: #!/bin/sh Then, make the file executable by typing this line (substitute your_file with the name of the file you created in the previous step): chmod +x your_file Next, you need to schedule the job with cron. If you want to see the current jobs scheduled with cron, type: crontab -l To edit the listings, you should type: crontab -e This will allow you to edit the file in vi (if that's your default editor). Use your vi commands to add a new line to the entry. 1. Minute (from 0 to 59) So, if you want your backup to run every morning at 3 a.m., you would add this while editing the crontab file: 0 3 * * * path_to_your_executable |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||