There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
UNIX/Linux
Tag Cloud
audio blue screen boot bsod computer cpu crash dell desktop driver drivers error excel external hard drive firefox format freezes freezing hard drive hardware hijackthis internet internet explorer itunes laptop malware motherboard mouse network networking outlook 2007 power printer problem ram router screen slow sound spyware trojan usb virus vista vista 32-bit windows windowsxp windows xp winxp wireless
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Operating Systems > UNIX/Linux >
backup script


Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
jackjill's Avatar
Junior Member with 11 posts.
 
Join Date: Nov 2004
Experience: Intermediate
07-Dec-2004, 05:52 PM #1
backup script
Description: I'm trying to write a shell script for taking backups. This Script will use cp command to take backups. Script can read the list of directories and destination directory from a file or ask user for this information interactively.

here is the final trial run of script.

Example 1: Only two options -i (for interactive run) and “-f file” (to read backup information from a file) are allowed. When an invalid option is entered script displays a message as shown below.

# a2backup -r
syntax: a2backup [ -i | -f file ]

Example 2: Example of interactive run.

# a2backup -i
Welcome to the Interactive Backup Utility
Enter the source directory [/home/maskara/sya710]:
Enter the destination directory: /home/backup
What type of backup do you want ( [i]ncremental/[f]ull backup) [i]:
Follow symbolic link (Y/N) [n]:

Directory backed up successfully.

Example 3: Backup information is read from file dir_list

# a2backup -f dir_list
Welcome to Interactive Backup Utility
Starting Backup..
Directory(ies) backed up successfully.

Example 4: Backup information is read from the file “.backup” in current user's home directory.

# a2backup
Welcome to Interactive Backup Utility
File “.backup” found in user's home directory.
Starting Backup..
Directory(ies) backed up successfully.

Example 5: File “.backup” does not exist in user's home directory.

# a2backup
Welcome to Interactive Backup Utility
File “.backup” NOT FOUND in user's home directory.
Exiting..

Syntax of backup information file (.backup or filename specified with –f option):

# the file may have following information

destination = destination_directory
source_directories = path1,path2,path3 ..
fullbackup = 1 # 1 means yes 0 means no
followsymlink = 0

Error checking and action:

Destination directory is created when does not exist.

If any of the source directory does not exist program terminates with an error message.

that's it.
Please tell me the easiest way to accomplish it.
tsunam's Avatar
Senior Member with 1,246 posts.
 
Join Date: Sep 2003
Experience: Linux~su
07-Dec-2004, 07:21 PM #2
I'll give a example of what a backup script will look like

#!/bin/bash
echo Starting Backup of System
tar cjpf /anime/stage4.tar.bz2 / --exclude=stage4.tar.bz2 --exclude=/proc --exclude=/anime --exclude=/usr/portage --exclude=/sys --exclude=/tmp --exclude=/mnt --exclude=/media
echo Finished Backup of System. Please save to cdrom disk

You can also do it with rsync or other backup applications. available with linux. Interactivity, can be done various ways as was shown in the other thread a ways back for grabbing input.
__________________
Gentoo Developer, and 64bit os user

"In feeding Mother Nature, you are fed in return" - Tsunam (2005). Concerning water conservation, and raising water tables.
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 05:27 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.