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.

Output not in order

Discussion in 'General Discussion' started by scottralf, Oct 13, 2011.

  1. scottralf

    scottralf Registered

    Joined:
    Aug 20, 2011
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Hi,

    I was trying to write a script to display
    Column 1 : Server IP/ Main IP
    Column 2 : Number of cPanel users
    Column 3 : Total number of domain
    Column 4 : Sub IP

    I was expecting output as below
    propper_column.jpg

    but the output was not as expected
    problem_column.jpg

    Here is my code
    Code:
    printf "Main IPs , No. of Account , No. of Domain , Sub IPs ,\n" > /root/domaincount.txt
    col1=`hostname -i`
    col2=`ls -alh /var/cpanel/users |grep -vE '^root|mysql' |cut -d" " -f4 |wc -l`
    col3=`cat /etc/ips |cut -d":" -f1`
    col4=`ls /etc/valiases |grep -vE '^root|mysql' |wc -l`
    printf "$col1 , $col2 , $col4 , $col3 ,\n" >> /root/domaincount.txt
    Any help will be great.

    Thank you.
     
  2. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,482
    Likes Received:
    203
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Is this helpful?:
    WHM > IP Functions > Show IP Address Usage

    Of course that does not answer your question, but similar functionality is already here in WHM.
     
  3. scottralf

    scottralf Registered

    Joined:
    Aug 20, 2011
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Hi Infopro,

    Thanks for the feedback. Yes, is useful information but I need to email out the details to my boss.

    Thank you.
     
Loading...

Share This Page