nixCraft Linux Forum

nixCraft

Linux Tech Support Forum

take backup of all indiviudal user dirs seperately of /home

This is a discussion on take backup of all indiviudal user dirs seperately of /home within the Shell scripting forums, part of the Development/Scripting category; Hi! I want to write a shell script which will take the backup of individual user home dirs existing in ...


Go Back   nixCraft Linux Forum > Development/Scripting > Shell scripting

Register FAQ Members List Calendar Forgotten your password? Mark Forums Read
  #1 (permalink)  
Old 07-04-2005, 03:21 PM
Junior Member
 
Join Date: Jul 2005
Posts: 1
Rep Power: 0
veerkumar
Default take backup of all indiviudal user dirs seperately of /home

Hi!
I want to write a shell script which will take the backup of individual user home dirs existing in /home partition. I am using the following script but it is continuing to be in loop and it is taking all the backup in a single tar file.

#!/bin/sh
# thsi script is used to take the backup of individual folders
# this script is userd to take the complete backup of the /home users and /apps user
# AUTHOR : - Veer Kumar
clear
cd /home/
for files in *
do
set $files
OF=/data/home/`hostname`_$1_bkp_$(date +%d%m%Y).tar.gz
#echo $OF
tar -czvf $OF *
done # exiting for loop
unset $files # un setting set variables
exit 0 # exititng shell script


can any one help me to take the backup of all users in /home partition.

Thanks,

Veer Kumar.
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-05-2005, 12:52 AM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
My distro: Ubuntu
Posts: 1,061
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

Change line
Code:
tar -czvf $OF *
To
Code:
tar -czvf $OF $files
And it should work for you
__________________
Vivek | My personal blog
Linux Evangelist
Play hard stay cool
Reply With Quote
  #3 (permalink)  
Old 07-06-2005, 05:46 PM
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by nixcraft
Change line
Code:
tar -czvf $OF *
To
Code:
tar -czvf $OF $files
And it should work for you

The suggestion worked very fine. Thanks very much.

Veer kumar.
Reply With Quote
  #4 (permalink)  
Old 07-12-2005, 06:33 AM
Junior Member
User
 
Join Date: Feb 2005
Posts: 23
Rep Power: 0
marinm
Default

We all appreciate Vivek's and monk's knowledge about shell scripting/Linux, right?

A big THANKS to Vivek and monk! Keep up this great work!
Reply With Quote
  #5 (permalink)  
Old 01-15-2008, 08:37 AM
Junior Member
User
 
Join Date: Jan 2008
My distro: Fedora
Posts: 1
Rep Power: 0
Sukarso is on a distinguished road
Default

Hi, all.

If I need to delete any files in target directory...please give me suggestion.

Thanks.


/sukarso
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Jailing vsftpd user to home directory grifs71 CentOS / RHEL / Fedora 2 12-26-2007 01:56 AM
pure-ftpd auto home dir problem asim.mcp Getting started tutorials 0 11-17-2007 07:31 AM
sendmail and mysql/user without home directory asim.mcp Getting started tutorials 0 07-07-2007 04:41 AM
UNIX ls only directories (display only dirs and no files) chiku Solaris/OpenSolaris 1 10-21-2006 01:27 AM
FreeBSD putty home key problem chiku All about FreeBSD/OpenBSD/NetBSD 2 02-03-2005 06:10 PM


All times are GMT +5.5. The time now is 01:46 AM.


Powered by vBulletin® Version 3.7.4 - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36