Results 1 to 5 of 5

Thread: take backup of all indiviudal user dirs seperately of /home

  1. #1
    Junior Member
    Join Date
    Jul 2005
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    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.

  2. #2
    Never say die nixcraft's Avatar
    Join Date
    Jan 2005
    Location
    BIOS
    Posts
    4,513
    Thanks
    17
    Thanked 807 Times in 511 Posts
    Rep Power
    10

    Default

    Change line
    Code:
    tar -czvf $OF *
    To
    Code:
    tar -czvf $OF $files
    And it should work for you
    All [Solved] threads are closed by mods / admin to avoid spam issues. See Howto mark a thread as [Solved]


  3. #3
    Guest

    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.

  4. #4
    Junior Member
    Join Date
    Feb 2005
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    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!

  5. #5
    Junior Member
    Join Date
    Jan 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default

    Hi, all.

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

    Thanks.


    /sukarso

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. pure-ftpd auto home dir problem
    By asim.mcp in forum Getting started tutorials
    Replies: 1
    Last Post: 15th August 2009, 03:32 AM
  2. Jailing vsftpd user to home directory
    By grifs71 in forum CentOS / RHEL / Fedora
    Replies: 2
    Last Post: 26th December 2007, 12:56 AM
  3. sendmail and mysql/user without home directory
    By asim.mcp in forum Getting started tutorials
    Replies: 0
    Last Post: 7th July 2007, 03:41 AM
  4. UNIX ls only directories (display only dirs and no files)
    By chiku in forum Solaris/OpenSolaris
    Replies: 1
    Last Post: 21st October 2006, 12:27 AM
  5. FreeBSD putty home key problem
    By chiku in forum All about FreeBSD/OpenBSD/NetBSD
    Replies: 2
    Last Post: 3rd February 2005, 05:10 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •