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.

fetchcsv

Discussion in 'General Discussion' started by johndoe, Aug 24, 2003.

  1. johndoe

    johndoe Active Member

    Joined:
    May 26, 2002
    Messages:
    36
    Likes Received:
    0
    Trophy Points:
    6
    Can anyone tell me where to find fetch CSV from SSH?

    thanks,

    johndoe

    cPanel.net Support Ticket Number:
     
  2. ciphervendor

    ciphervendor Well-Known Member

    Joined:
    Aug 26, 2002
    Messages:
    1,052
    Likes Received:
    0
    Trophy Points:
    36
    /var/cpanel/accts.db

    cPanel.net Support Ticket Number:
     
  3. johndoe

    johndoe Active Member

    Joined:
    May 26, 2002
    Messages:
    36
    Likes Received:
    0
    Trophy Points:
    6
    Many thanks...

    johndoe

    cPanel.net Support Ticket Number:
     
  4. asmithjr

    asmithjr Well-Known Member

    Joined:
    Jun 13, 2003
    Messages:
    475
    Likes Received:
    1
    Trophy Points:
    18
    I see the account info in the /var/cpanel/accts.db.

    Can you tell me where the email addresses are stored for the contacts?
     
  5. asmithjr

    asmithjr Well-Known Member

    Joined:
    Jun 13, 2003
    Messages:
    475
    Likes Received:
    1
    Trophy Points:
    18
    account information including email contact

    found them /home/accountname/.contactemail

    Here is a script I wrote to send me the information in a spreadsheet.
    Code:
    #!/bin/sh
    # getaccts.sh
    # create a spreadsheet of user accounts - domain, userid, contact_email
    #
    
    # get a copy of the users info
    ACCOUNTS=/var/cpanel/accts.db
    
    # create temp file with domain,userid in it
    cat $ACCOUNTS | awk -F"," '{printf "%s,%s\n",$1,$2}' > tmpaccts
    
    # create temp file with email addresses, one from each line in tmpaccts
    for i in `awk -F"," '{print $2}' tmpaccts`
    do
            cat /home/$i/.contactemail >> tmpemails
            echo " " >> tmpemails
    done
    
    # build the first row ot the spreadsheet
    echo "Domain,User Id,Email Address" > accounts.csv
    
    # combine the temp files to make our spreadsheet
    paste tmpaccts tmpusers tmpemails | sed -e 's|  |,|g' >> accounts.csv
    
    # filenm is the name of the file to send
    # emailto is the address to send it to
    filenm=accounts.csv
    emailto=someemail@domainname
    
    uuencode $filenm $filenm | mail -s "Accounts Filename: $filenm" $emailto
    
    rm tmpaccts tmpemails
    rm accounts.csv                 # comment out if you do not want to remove file
    
    #
    # End
    #
    
     
  6. Snowman30

    Snowman30 Well-Known Member
    PartnerNOC

    Joined:
    Apr 7, 2002
    Messages:
    681
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    DataCenter Provider
    whre does the accouint list live now as accts.db tells me to use cpanel accounting now???

    i need a list of all the accts data on one file
     
Loading...
Similar Threads - fetchcsv
  1. iso99
    Replies:
    2
    Views:
    230

Share This Page