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.

What is the script name for assignment of accounts to a reseller?

Discussion in 'General Discussion' started by sharmaine001, Sep 15, 2009.

  1. sharmaine001

    sharmaine001 Well-Known Member

    Joined:
    Jun 23, 2006
    Messages:
    143
    Likes Received:
    0
    Trophy Points:
    16
    In WHM, there is an area where accounts can be assigned to a reseller. It's located in Reseller Center

    What is the script being used for that? Reason is i have 100 accounts to assign move from one reseller to another and I want to automate it in SSH. I can retrieve the current assignment from truedomains file but I don't know what script to use and what is the command to execute re-assignment of account to another reseller in ssh. I know cpanel has scripts located in /scripts folder.

    I hope somebody can help me.
     
  2. MattCurry

    MattCurry Well-Known Member

    Joined:
    Aug 18, 2009
    Messages:
    275
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Houston, Tx
    Hello,

    I do understand what you mean, unfortunately this is not something that we can directly support. However, this can be done through the WHM interface. Please let me know if you have any other questions.

    Thank you,
    Matthew Curry
     
  3. sharmaine001

    sharmaine001 Well-Known Member

    Joined:
    Jun 23, 2006
    Messages:
    143
    Likes Received:
    0
    Trophy Points:
    16
    Yes i know it can be done in WHM but since it's 100 accounts, it will tedious to search through the list and assign to the new reseller account. Im looking for a way for this to be easier if i have to do this for 100 accounts
     
  4. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,458
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    The URLs in WHM that contain references to /scripts have little to no relation to the /scripts directory in the root partition.

    In this case there is no command line script to change the account owner. Nor do I see an API function to accomplish this.
     
  5. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    You need to replace the "OWNER=" line in the respective account files /var/cpanel/users
     
  6. sharmaine001

    sharmaine001 Well-Known Member

    Joined:
    Jun 23, 2006
    Messages:
    143
    Likes Received:
    0
    Trophy Points:
    16
    so is there no way to write a bash script that will automatically get all accounts assigned to ResellerA and then change the assignment to ResellerB?
     
  7. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    I would say you apparently didn't read my previous post! :rolleyes:

    (I told you what you needed to do in the last past)

    Code:
    #!/bin/bash
    IFS="$"
    
    cd /var/cpanel/users
    
    if [ $# = 2 ]; then
       replace "OWNER=${1}" "OWNER=${2}" -- /var/cpanel/users/*
    else
       echo "USAGE:   ./${0} <old reseller login>  <new reseller login>"
    fi
    
     
    #7 Spiral, Oct 9, 2009
    Last edited: Oct 9, 2009
  8. sharmaine001

    sharmaine001 Well-Known Member

    Joined:
    Jun 23, 2006
    Messages:
    143
    Likes Received:
    0
    Trophy Points:
    16
    Ops.. sorry I misunderstood your post.

    I don't understand much of the script you posted. Do i need to change OWNER=${1} with ResellerA and OWNER=${2} with ResellerB? So its something like this:

    replace "reseller1" "reseller2" -- /var/cpanel/users/*

    reseller1 is the username of the old reseller
    reseller2 is the username of the new reseller
     
    #8 sharmaine001, Oct 9, 2009
    Last edited: Oct 9, 2009
  9. bvierra

    bvierra Well-Known Member

    Joined:
    Jul 28, 2006
    Messages:
    55
    Likes Received:
    1
    Trophy Points:
    8
    Location:
    Southern California
    thats a bad idea, what if somewhere else it contains reseller1 in the file.... use the script provided.
     
  10. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    As bvierra tried to point out to you above, I wrote the script specifically so that only the reseller owning the account would be changed. If you remove the "OWNER=" from the replace line then you are running the replace command against the entire user file and that could be very bad as you would end up altering the reseller account details themselves or possibly matching against other places you don't want to match.

    You can manually run a replace command instead of using the script but you would need to keep the same format as the script and replace ${1} with the old reseller name and ${2} with the new reseller name if you were just going to manually run your own replace command.

    Frankly, the script I quick whipped up for you is a lot easier. ;)
     
  11. sharmaine001

    sharmaine001 Well-Known Member

    Joined:
    Jun 23, 2006
    Messages:
    143
    Likes Received:
    0
    Trophy Points:
    16
    Hmm how about if I want that i will determine which accounts to be assigned to another reseller by package?

    I notice that when I acquire accounts, the user is also "root" so I cannot base the transfer from the account name
     
Loading...

Share This Page