send all accounts list by mail one time per week instead of downloading it
Dears,
We need a solution to send the accounts list by mail one time per week by instead off downloading the list manually
The information needed is the current storage used by client, package, username, main domain ...
Any help from your side will be really appreciated.
Best regards
-
Hey there! Can you let me know what tool you have in place that generates such a list? Are you using the cPanel API tools to create that list? 0 -
Thank you for your feedback, Actually we are downloading manually the list from the WHM as CSV 0 -
thank you for your feedback i have create the script you will find it bellow if any one need it [QUOTE] #!/bin/bash # Get the server hostname HOSTNAME=$(hostname) # Run whmapi1 listaccts and output to a csv file whmapi1 listaccts --output=json | jq -r --arg hostname $(hostname -f) '.data.acct[] | [.user, .domain, .ip, .email, .uid, .owner, .startdate, .unix_startdate, .plan, .diskused, .disklimit, $hostname, .suspended, .suspendtime, .suspendreason, .mailbox_format, .legacy_backup, .backup, .partition, .max_email_per_hour, .inodesused, .inodeslimit, .max_defer_fail_percentage, .outgoing_mail_suspended, .outgoing_mail_hold, .has_backup] | @csv' > accounts.csv # Convert the csv file to Google Spreadsheet format sed -i '1s/^/User,Domain Name,IP Address, Email,Account Name,Owner,Start Date, Unix Start Date,Package,Disk Usage,Disk Limit, Server Hostname,Suspended, Suspend time,Suspend reason,Mailbox Format, Legacy Backup, Backup, Partition, Max Email Per Hour, Inodes Used, Inodes Limit, Max Defer Fail Percentage, Outgoing mail suspended, Outgoing mail hold, Has Backup\n/' accounts.csv # Send the csv file via email echo "See attached file for list of accounts." | mailx -s "WHM Accounts List $HOSTNAME" -a accounts.csv xxxx@xxxxxx.xx # Remove the csv file rm accounts.csv 0
Please sign in to leave a comment.
Comments
4 comments