Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Member
    Join Date
    Aug 2004
    Posts
    215

    Post nice way to patch backup and restore accounts

    hi all

    see the following scripts i made and tell me feedback and ideas about it
    Last edited by s_2_s; 02-10-2005 at 03:53 AM.

  2. #2
    Member
    Join Date
    Aug 2004
    Posts
    215

    Default

    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


    #!/bin/sh
    # Ilmade by s_2_s CPANEL FORUMS
    cat userlist.txt | \
    while read line
    do
    echo "Found user: $line"
    /scripts/pkgacct $line
    done
    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

    #!/bin/sh
    # Ilmade by s_2_s CPANEL FORUMS
    cat userlist.txt | \
    while read line
    do
    echo "Found user: $line"
    echo "I'm restoring $line ... ... ..."
    /scripts/restorepkg $line

    done
    Last edited by s_2_s; 02-10-2005 at 04:43 AM.

  3. #3
    Member
    Join Date
    Aug 2004
    Posts
    215

    Default

    how to make a list of users under one reseller ?

  4. #4
    Member
    Join Date
    Sep 2004
    Posts
    422

    Default

    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.
    Last edited by DigitalN; 02-10-2005 at 03:44 PM.

  5. #5
    Member
    Join Date
    Aug 2004
    Posts
    215

    Default

    Thank you m8
    i will soon make something useful and handy from that

Similar Threads & Tags
Similar threads

  1. Shell script for backup and restore
    By inddeveloper in forum Data Protection
    Replies: 4
    Last Post: 08-28-2010, 09:24 AM
  2. trying to call shell script with plugin
    By sime in forum cPanel Developers
    Replies: 4
    Last Post: 08-02-2007, 01:07 PM
  3. Charset From Shell For PHP Script.
    By dkz in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 08-04-2005, 11:41 AM
  4. shell script: remove everything behind .'s
    By laborspy in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 04-09-2004, 08:57 AM
  5. Automating Account Creation: Shell Script? PHP Script?
    By RangerWest in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 07-13-2003, 09:24 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube