Register
It is currently Sat Nov 01, 2014 6:27 am

Backup SCript


All times are UTC - 6 hours


Post new topic Reply to topic  [ 4 posts ] 
Author Message
 PostPosted: Wed May 18, 2005 4:20 pm   

Joined: Wed May 18, 2005 4:01 pm
Posts: 3
I'm looking for a script that will, when launched, backup files/folders and exclude certain file names/types from variables inside script and log this to /var/log/backup.. but all in a single file! Currently I am using a simple bash script with tar include/exclude name in file "include"/"exclude" but I want to include the 3 of them into 1..
this is what I have right now.

tar czvf /BackupJobs/${HOSTNAME}--$(date +%Y-%m-%d).tgz --files-from=/BackupJobs/system --exclude-from=/BackupJobs/exclude

This is basically what I want:

variable [backup_path] = /BackupJobs
variable [exclude_extension] = .iso, .tar, .gzip
variable [exclude_dir] = /tmp
variable [include] = /var/log, /root, /home

tar czvf ["backup_path" variable]/&{hostname} ......... --files-from=["include" variable] --exclude-from=["exclude_extension" variable] --exclude-from= ["exclude_dir" variable]



can someone please help me out,
can't seem to get this all to work for me
Thanks
Freeballer


Top
 Profile  
 PostPosted: Wed May 18, 2005 10:46 pm   
Site Admin

Joined: Tue May 17, 2005 7:31 pm
Posts: 251
Location: Georgia
ok...so let me kind of get this in order...
you want a script that will backup three different directories...
/var/log
/root
/home

you want ALL files backed up except files with the extensions
.iso
.tar
.gzip

seems easy enough :)

i would like to see what script you are using now...that way i can edit it to work the way you want it to.
just post it under the utility scripts section and i will post a fix :)

Code:
-r, --append
              append files to the end of an archive


Top
 Profile  
 PostPosted: Thu May 19, 2005 10:12 am   

Joined: Wed May 18, 2005 4:01 pm
Posts: 3
I've posted the script online in the utility section as you requested, unfortunatly the exclude function doesn't work for me but perhaps you can get it to work without need for a seperate file

WARNING COMPLETELY BROKEN AT TIME OF LAST TESTING
now I use --files-from= --exclude-from= and replace those variables in script

http://bashscripts.org/viewtopic.php?t=100


Top
 Profile  
 PostPosted: Thu May 19, 2005 10:07 pm   
Site Admin

Joined: Tue May 17, 2005 7:31 pm
Posts: 251
Location: Georgia
the reason the script you have is "broken" is because the options you are passing to tar are not what they are actually used for...
example:
Quote:
--exclude=FILE
exclude file FILE

--exclude-from FILE
exclude files listed in FILE


you are trying to make it look at extensions or directories instead of a particular file or a file with files listed within it.

i'm going to play with it and see what i can make it do...should be a fun script :)


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot] and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP