The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

help me do this shell script

Discussion in 'General Discussion' started by s_2_s, Feb 10, 2005.

  1. s_2_s

    s_2_s Well-Known Member

    Joined:
    Aug 9, 2004
    Messages:
    215
    Likes Received:
    0
    Trophy Points:
    16
    nice way to patch backup and restore accounts

    hi all

    see the following scripts i made and tell me feedback and ideas about it
     
    #1 s_2_s, Feb 10, 2005
    Last edited: Feb 10, 2005
  2. s_2_s

    s_2_s Well-Known Member

    Joined:
    Aug 9, 2004
    Messages:
    215
    Likes Received:
    0
    Trophy Points:
    16
    asking mr google about how to read lines from files i could manage to do a script to read account user names from a file then backup each one and another script to restore them


    script to backup accounts from a user list in file


    note that userlist.txt should look like this
    user1
    user2
    user3
    user4


    now to restore the backups made from the above script put the tar.gz files under same dir and excute thjis shell script

     
    #2 s_2_s, Feb 10, 2005
    Last edited: Feb 10, 2005
  3. s_2_s

    s_2_s Well-Known Member

    Joined:
    Aug 9, 2004
    Messages:
    215
    Likes Received:
    0
    Trophy Points:
    16
    how to make a list of users under one reseller ?
     
  4. DigitalN

    DigitalN Well-Known Member

    Joined:
    Sep 23, 2004
    Messages:
    420
    Likes Received:
    1
    Trophy Points:
    18
    You could use the /var/cpanel/users/* files

    something like

    Code:
    #!/bin/sh
    reseller=root
    for user in `/bin/ls /var/cpanel/users`
    do
    if [ "`/bin/grep 'OWNER=' /var/cpanel/users/$user | cut -d= -f2`" == "$reseller" ]; then
    echo "$user" >> user_list
    fi
    done
    Could be used for the user part.
     
    #4 DigitalN, Feb 10, 2005
    Last edited: Feb 10, 2005
  5. s_2_s

    s_2_s Well-Known Member

    Joined:
    Aug 9, 2004
    Messages:
    215
    Likes Received:
    0
    Trophy Points:
    16
    Thank you m8
    i will soon make something useful and handy from that
     
Loading...

Share This Page