Archives

Database only backups in WHM

 Some clients asked us if you can set up only database backups in WHM. For some, this will sound strange, but there are users who want such a feature. 

You can access WHM backup settings via WHM->Backup->Backup Configuration. Unfortunately, there is no option at this moment to backup only users’ databases.

whm database backup

As of September 25, 2018, this cPanel request is in “Open Discussion” status. You can comment and vote at cPanel Feature Requests Site

 

What solutions do you have? You can use bash commands. One command to backup all the databases on the server to a .gz archive is:

root@www [/backup]# mysqldump --all-databases | gzip > /backup/$(date +%Y-%h-%d)-alldatabases.sql.gz

This will create a backup with all MySQL/MariaDB databases on the server. The filename will include the current date. (e.g. 2018-Sep-25-alldatabases.sql.gz) You can modify the command per your needs. You can also create a cron job to run it at specific times.

Another possibility is to backup each database on the server individually. For this create a new file like backupdbs.sh  The content of the file is:

#!/bin/bash

mysql=/usr/bin/mysql
mysqldump=/usr/bin/mysqldump
date=$(date +%Y-%h-%d)

backupdir="/backup"
mkdir -p $backupdir/$date

databases=`$mysql -e "SHOW DATABASES;" | grep -Ev "(Database|information_schema)"`
for db in $databases; do
echo $db
$mysqldump --opt --databases $db | gzip > "$backupdir/$date/$db.sql.gz"
done

To run the script:

root@www [/backup]# perl backupdbs.sh

As in the previous case, you can also adjust the script per your needs and create a cron job.

Share this post:

Where to find forwarders/autoresponders on a cPanel server

Many times while troubleshooting clients’ mail issues you will need to find out the forwarders/autoresponders they have. 

On a cPanel server, this information is kept in separate files for each domain(and subdomain) in the /etc/valiases/ directory – like /etc/valiases/domain123.com; /etc/valiases/homedomain.net etc.

After root login, look for the interested domain as:

root@www [~]# cd /etc/valiases/
root@www [/etc/valiases]# cat phdomain123.com
contact@plothost123.com: "|/home/phdomain123/pipe.php"
autoresponder@phdomain123.com: "|/usr/local/cpanel/bin/autorespond autoresponder@phdomain123.com /home/phdomain123/.autorespond"
postmaster@phdomain123.com: admin@phdomain123.com
*: ":fail: No such person at this address"
root@web [/etc/valiases]#

In our example:
– the first line is a forwarder to a file (a PHP script)
– the second line is an autoresponder for the email autoresponder@phdomain123.com
– the third line is a forwarder to an email address
– the fourth line is the default action for unrouted emails. In this case, the “No such person at this address” message will be sent back.

If you don’t like the command line, you can use a plugin for WHM called ConfigServer Mail Manage. After installation, access it from WHM->Plugins->ConfigServer Mail Manage; choose the domain from the list and click the Manage Mail Forwarders button. You will see something like:

cfs mail manage

You can also check forwarders/autoresponders by accessing the client’s cPanel account.

Related post: How to setup an Email Forwarder in cPanel

Share this post:

Backup all cPanel accounts of a reseller

Sometimes it can be very useful to create cpmove archives (backups) for all the accounts owned by a reseller. There is no way to do this via WHM. We will show a method here by using the cPanel pkgacct script and the WHM API listaccts function.

Below is the command to backup all accounts owned by reseller_username (replace reseller_username with your reseller username and specify the output directory):

for i in $(whmapi1 listaccts searchtype=owner search=reseller_username want=user | grep user: | awk '{print $2}'); do /scripts/pkgacct $i /backup/choose_directory; done
The output directory MUST exist. Otherwise, the backups will be created in /home directory. The backups will be created as cpmove-___.tar.gz files.

———————————————–

An example – reseller account max – it has one owned cPanel account – max1:

root@sweb [~]# for i in $(whmapi1 listaccts searchtype=owner search=max want=user | grep user: | awk '{print $2}'); do /scripts/pkgacct $i /backup/max; done
[2018-04-05 11:39:20 -0500] pkgacct started.
[2018-04-05 11:39:20 -0500] pkgacct version 10 - user : max1 - tarball: 1 - target mysql : default - split: 0 - incremental: 0 - homedir: 1 - mailman: 1 - backup: 0 - archive version: 4 - running with uid 0
[2018-04-05 11:39:20 -0500] pkgacct using '/usr/local/cpanel/3rdparty/bin/pigz -6 --processes 1 --blocksize 128 --rsyncable' to compress archives
[2018-04-05 11:39:20 -0500] pkgacct working dir : /backup/max/cpmove-max1
[2018-04-05 11:39:20 -0500] Copying Reseller Config...[2018-04-05 11:39:20 -0500] Done
[2018-04-05 11:39:20 -0500] Copying Suspension Info (if needed)...[2018-04-05 11:39:20 -0500] Done
[2018-04-05 11:39:20 -0500] Copying installed SSL certificates and keys...[2018-04-05 11:39:20 -0500] Performing “ApacheTLS” component....
[2018-04-05 11:39:20 -0500] Completed “ApacheTLS” component.
[2018-04-05 11:39:20 -0500] Done
[2018-04-05 11:39:20 -0500] Storing SSL domain......[2018-04-05 11:39:20 -0500] Done
[2018-04-05 11:39:20 -0500] Copying Domain Keys....[2018-04-05 11:39:20 -0500] Done
[2018-04-05 11:39:20 -0500] Copying Counter Data....[2018-04-05 11:39:20 -0500] Done
[2018-04-05 11:39:20 -0500] Copying Bandwidth Data....[2018-04-05 11:39:20 -0500] Performing “Bandwidth” component....
Summary databases … done!
[2018-04-05 11:39:20 -0500] Completed “Bandwidth” component.
[2018-04-05 11:39:20 -0500] Done
[2018-04-05 11:39:20 -0500] Copying Dns Zones.......max1.com...[2018-04-05 11:39:20 -0500] Done
[2018-04-05 11:39:20 -0500] Copying Mail files....[2018-04-05 11:39:20 -0500] Done
[2018-04-05 11:39:20 -0500] Copying proftpd file....[2018-04-05 11:39:20 -0500] Done
[2018-04-05 11:39:20 -0500] Copying www logs.......log file sizes [0 byte(s)]......max1.com...[2018-04-05 11:39:20 -0500] Done
[2018-04-05 11:39:20 -0500] Copy userdata...[2018-04-05 11:39:20 -0500] Done
[2018-04-05 11:39:20 -0500] Copy custom virtualhost templates...[2018-04-05 11:39:20 -0500] Done
[2018-04-05 11:39:20 -0500] Copying mailman lists and archives....[2018-04-05 11:39:20 -0500] Done copying mailman lists and archives.
[2018-04-05 11:39:20 -0500] Copying homedir.............
[2018-04-05 11:39:20 -0500] Done
[2018-04-05 11:39:20 -0500] Fixing up EA4 .htaccess blocks: Done.
[2018-04-05 11:39:20 -0500] Performing “Postgresql” component....
[2018-04-05 11:39:20 -0500] Completed “Postgresql” component.
[2018-04-05 11:39:20 -0500] Performing “Mysql” component....
[2018-04-05 11:39:20 -0500] Determining mysql dbs...[2018-04-05 11:39:20 -0500] ...mysqldump version: 10.1.32...[2018-04-05 11:39:20 -0500] ...mysql version: 10.1...[2018-04-05 11:39:20 -0500] Saving mysql privs...[2018-04-05 11:39:20 -0500] Done
[2018-04-05 11:39:20 -0500] ...Done
[2018-04-05 11:39:20 -0500] Storing mysql dbs...[2018-04-05 11:39:20 -0500] ...Done
[2018-04-05 11:39:20 -0500] Completed “Mysql” component.
[2018-04-05 11:39:20 -0500] Copying cpuser file.......[2018-04-05 11:39:20 -0500] Done
[2018-04-05 11:39:20 -0500] Copying crontab file.......[2018-04-05 11:39:20 -0500] Done
[2018-04-05 11:39:20 -0500] Performing “Quota” component....
[2018-04-05 11:39:20 -0500] Completed “Quota” component.
[2018-04-05 11:39:20 -0500] Performing “Integration” component....
[2018-04-05 11:39:20 -0500] Completed “Integration” component.
[2018-04-05 11:39:20 -0500] Performing “AuthnLinks” component....
[2018-04-05 11:39:20 -0500] Completed “AuthnLinks” component.
[2018-04-05 11:39:20 -0500] Performing “APITokens” component....
[2018-04-05 11:39:20 -0500] Completed “APITokens” component.
[2018-04-05 11:39:20 -0500] Performing “AutoSSL” component....
[2018-04-05 11:39:20 -0500] Completed “AutoSSL” component.
[2018-04-05 11:39:20 -0500] Storing Subdomains....
[2018-04-05 11:39:20 -0500] Done
[2018-04-05 11:39:20 -0500] Storing Parked Domains....
[2018-04-05 11:39:20 -0500] Done
[2018-04-05 11:39:20 -0500] Storing Addon Domains....
[2018-04-05 11:39:20 -0500] Copying password.......[2018-04-05 11:39:20 -0500] Done
[2018-04-05 11:39:20 -0500] Copying shell.......[2018-04-05 11:39:20 -0500] Done
[2018-04-05 11:39:20 -0500] Performing “PublicContact” component....
[2018-04-05 11:39:20 -0500] Completed “PublicContact” component.
[2018-04-05 11:39:20 -0500] Creating Archive ....[2018-04-05 11:39:20 -0500] Done
[2018-04-05 11:39:20 -0500] pkgacctfile is: /backup/max/cpmove-max1.tar.gz
[2018-04-05 11:39:20 -0500] md5sum is: 14b564a6740f515a05573d1678a0a0b8
[2018-04-05 11:39:20 -0500]
[2018-04-05 11:39:20 -0500] size is: 63125
[2018-04-05 11:39:20 -0500]
[2018-04-05 11:39:20 -0500] homesize is: 167936
[2018-04-05 11:39:20 -0500]
[2018-04-05 11:39:20 -0500] homefiles is: 54
[2018-04-05 11:39:20 -0500] pkgacct completed
[2018-04-05 11:39:20 -0500] pkgacct started.
[2018-04-05 11:39:20 -0500] pkgacct version 10 - user : max - tarball: 1 - target mysql : default - split: 0 - incremental: 0 - homedir: 1 - mailman: 1 - backup: 0 - archive version: 4 - running with uid 0
[2018-04-05 11:39:20 -0500] pkgacct using '/usr/local/cpanel/3rdparty/bin/pigz -6 --processes 1 --blocksize 128 --rsyncable' to compress archives
[2018-04-05 11:39:20 -0500] pkgacct working dir : /backup/max/cpmove-max
[2018-04-05 11:39:20 -0500] Copying Reseller Config...[2018-04-05 11:39:20 -0500]
[2018-04-05 11:39:20 -0500] Copying Reseller Packages and Features ...
[2018-04-05 11:39:20 -0500] Done
[2018-04-05 11:39:20 -0500] Copying Suspension Info (if needed)...[2018-04-05 11:39:20 -0500] Done
[2018-04-05 11:39:20 -0500] Copying installed SSL certificates and keys...[2018-04-05 11:39:20 -0500] Performing “ApacheTLS” component....
[2018-04-05 11:39:20 -0500] Completed “ApacheTLS” component.
[2018-04-05 11:39:20 -0500] Done
[2018-04-05 11:39:20 -0500] Storing SSL domain......[2018-04-05 11:39:20 -0500] Done
[2018-04-05 11:39:20 -0500] Copying Domain Keys....[2018-04-05 11:39:20 -0500] Done
[2018-04-05 11:39:20 -0500] Copying Counter Data....[2018-04-05 11:39:20 -0500] Done
[2018-04-05 11:39:20 -0500] Copying Bandwidth Data....[2018-04-05 11:39:20 -0500] Performing “Bandwidth” component....
Summary databases … done!
[2018-04-05 11:39:20 -0500] Completed “Bandwidth” component.
[2018-04-05 11:39:20 -0500] Done
[2018-04-05 11:39:20 -0500] Copying Dns Zones.......max.com...[2018-04-05 11:39:20 -0500] Done
[2018-04-05 11:39:20 -0500] Copying Mail files....[2018-04-05 11:39:20 -0500] Done
[2018-04-05 11:39:20 -0500] Copying proftpd file....[2018-04-05 11:39:20 -0500] Done
[2018-04-05 11:39:20 -0500] Copying www logs.......log file sizes [0 byte(s)]......max.com...[2018-04-05 11:39:20 -0500] Done
[2018-04-05 11:39:20 -0500] Copy userdata...[2018-04-05 11:39:20 -0500] Done
[2018-04-05 11:39:20 -0500] Copy custom virtualhost templates...[2018-04-05 11:39:20 -0500] Done
[2018-04-05 11:39:20 -0500] Copying mailman lists and archives....[2018-04-05 11:39:20 -0500] Done copying mailman lists and archives.
[2018-04-05 11:39:20 -0500] Copying homedir.............
[2018-04-05 11:39:20 -0500] Done
[2018-04-05 11:39:21 -0500] Fixing up EA4 .htaccess blocks: Done.
[2018-04-05 11:39:21 -0500] Performing “Postgresql” component....
[2018-04-05 11:39:21 -0500] Completed “Postgresql” component.
[2018-04-05 11:39:21 -0500] Performing “Mysql” component....
[2018-04-05 11:39:21 -0500] Determining mysql dbs...[2018-04-05 11:39:21 -0500] ...mysqldump version: 10.1.32...[2018-04-05 11:39:21 -0500] ...mysql version: 10.1...[2018-04-05 11:39:21 -0500] Saving mysql privs...[2018-04-05 11:39:21 -0500] Done
[2018-04-05 11:39:21 -0500] ...Done
[2018-04-05 11:39:21 -0500] Storing mysql dbs...[2018-04-05 11:39:21 -0500] ...Done
[2018-04-05 11:39:21 -0500] Completed “Mysql” component.
[2018-04-05 11:39:21 -0500] Copying cpuser file.......[2018-04-05 11:39:21 -0500] Done
[2018-04-05 11:39:21 -0500] Copying crontab file.......[2018-04-05 11:39:21 -0500] Done
[2018-04-05 11:39:21 -0500] Performing “Quota” component....
[2018-04-05 11:39:21 -0500] Completed “Quota” component.
[2018-04-05 11:39:21 -0500] Performing “Integration” component....
[2018-04-05 11:39:21 -0500] Completed “Integration” component.
[2018-04-05 11:39:21 -0500] Performing “AuthnLinks” component....
[2018-04-05 11:39:21 -0500] Completed “AuthnLinks” component.
[2018-04-05 11:39:21 -0500] Performing “APITokens” component....
[2018-04-05 11:39:21 -0500] Completed “APITokens” component.
[2018-04-05 11:39:21 -0500] Performing “AutoSSL” component....
[2018-04-05 11:39:21 -0500] Completed “AutoSSL” component.
[2018-04-05 11:39:21 -0500] Storing Subdomains....
[2018-04-05 11:39:21 -0500] Done
[2018-04-05 11:39:21 -0500] Storing Parked Domains....
[2018-04-05 11:39:21 -0500] Done
[2018-04-05 11:39:21 -0500] Storing Addon Domains....
[2018-04-05 11:39:21 -0500] Copying password.......[2018-04-05 11:39:21 -0500] Done
[2018-04-05 11:39:21 -0500] Copying shell.......[2018-04-05 11:39:21 -0500] Done
[2018-04-05 11:39:21 -0500] Performing “PublicContact” component....
[2018-04-05 11:39:21 -0500] Completed “PublicContact” component.
[2018-04-05 11:39:21 -0500] Creating Archive ....[2018-04-05 11:39:21 -0500] Done
[2018-04-05 11:39:21 -0500] pkgacctfile is: /backup/max/cpmove-max.tar.gz
[2018-04-05 11:39:21 -0500] md5sum is: 6165782f02dffdfdb62892a5e4669f27
[2018-04-05 11:39:21 -0500]
[2018-04-05 11:39:21 -0500] size is: 63383
[2018-04-05 11:39:21 -0500]
[2018-04-05 11:39:21 -0500] homesize is: 1949696
[2018-04-05 11:39:21 -0500]
[2018-04-05 11:39:21 -0500] homefiles is: 58
[2018-04-05 11:39:21 -0500] pkgacct completed
root@web [~]# ls /backup/max
./  ../  cpmove-max.tar.gz  cpmove-max1.tar.gz
root@web [~]#

Share this post:

Brotli support in cPanel/EasyApache 4

Brotli is a data format specification for data streams compressed with a specific combination of the general-purpose LZ77 lossless compression algorithm, Huffman coding and 2nd order context modelling.

You can get into Brotli details on the Wikipedia page at https://en.wikipedia.org/wiki/Brotli

In simple terms, Brotli is similar to the gzip web compression. It was developed by Google. As of the present date, Brotli is supported by all major web browsers – Microsoft Edge, Google Chrome, Mozilla Firefox, Opera and Safari.
Also, Brotli is supported by web servers – Apache HTTP Server (w/ mod_brotli module), nginx (w/ ngx_brotli module), LiteSpeed Web Server, Node.js (w/ shrink-ray community module) .
cURL supports Brotli since version 7.57 (November 2017).

ea4 mod_brotli

To enable Brotli on your cPanel/WHM server:

  1. Log in to your WHM panel as root.
  2. Navigate to Software->EasyApache 4
  3. Click the Customize button
  4. Now on the Apache Modules tab, search and select mod_brotli.
  5. Click the Next button few times and in the end click Provision button.
  6. You will see the confirmation message The provision process is complete.

You can also add support for Brotli via the command line:

root@web [~]# yum install ea-apache24-mod_brotli.x86_64

 

Check if your site uses Brotli at https://tools.keycdn.com/brotli-test In our case the result is:

brotli test

The Content-encoding header will be:

Content-Encoding: br

Share this post:

cPanel & WHM logs location

On a cPanel web server there are many logs. We made here a list of them:

cPanel, WHM and Webmail
Access logs and user actions /usr/local/cpanel/logs/access_log
Account transfers and misc. logs /var/cpanel/logs
Auditing log (account creations, deletions, etc) /var/cpanel/accounting.log
Backup logs /usr/local/cpanel/logs/cpbackup
Backup transport logs /usr/local/cpanel/logs/cpbackup_transporter.log
Boxtrapper log ~/mail/MAILDIR/boxtrapper/log
Brute force protection (cphulkd) log /usr/local/cpanel/logs/cphulkd.log
Brute force protection (cphulkd) error log /usr/local/cpanel/logs/cphulkd_errors.log
cPanel dnsadmin dns clustering daemon /usr/local/cpanel/logs/dnsadmin_log
cPanel taskqueue processing demon /usr/local/cpanel/logs/queueprocd.log
Dbmapping /usr/local/cpanel/logs/setupdbmap_log
EasuApache build logs /usr/local/cpanel/logs/easy/apache/
Error log /usr/local/cpanel/logs/error_log
Installation log /var/log/cpanel-install.log
License updates & errors /usr/local/cpanel/logs/license_log
Locale database modifications /usr/local/cpanel/logs/build_locale_databases_log
Login errors (cpsrvd) /usr/local/cpanel/logs/login_log
Logs for all incoming requests for cpsrvd /usr/local/cpanel/logs/incoming_http_requests.log
Horde Webmail /var/cpanel/horde/log/
RoundCube Webmail /var/cpanel/roundcube/log/
SquirrelMail Webmail /var/cpanel/squirrelmail/ (nothing logged)
MySQL upgrade log /var/cpanel/logs/mysql_upgrade.log
Panic log /usr/local/cpanel/logs/panic_log
Per-account bandwidth history – cached /var/cpanel/bandwidth.cache/{username}
Per-account bandwidth history human readable /var/cpanel/bandwidth/{username}
Service status logs /var/log/chkservd.log
Tailwatchd log /usr/local/cpanel/logs/tailwatch_log
Update analysis reporting /usr/local/cpanel/logs/update_analysis/{TIMESTAMP}.log
Update (upcp) log /var/cpanel/updatelogs/update.{TIMESTAMP}.log
Webdisk (cpdavd) log /usr/local/cpanel/logs/cpavd_error_log
Website statistics log /usr/local/cpanel/logs/stats_log
cPanel support access /var/cpanel/logs/supportauth/audit.log

 

FTP (Pure-FTPD,Pro-FTPD)
FTP transaction log /usr/local/apache/domlogs/
Log for FTP transfers /usr/local/apache/domlogs/ftpxferlog
Login attempts/general info /var/log/messages

 

Named (BIND), NSD, MyDNS, SSHD
Login attempts/general info /var/log/messages

 

Mail delivery (Exim)
Delivery & receipt log /var/log/exim_mainlog
Incoming mail queue /var/spool/exim/input/
Log of messages rejected based on ACLs or other policies /var/log/exim_rejectlog
Unexpected/fatal error log /var/log/exim_paniclog

 

Mail retrieval & Spam Protection (Courier, Dovecot, SpamAssassin)
IMAP/POP login attempts, transactions, fatal errors and spam scoring

/var/log/maillog

/var/log/messages

 

Mailman
Logs /usr/local/cpanel/3rdparty/mailman/logs

 

MySQL/MariaDB
General information and errors /var/lib/mysql/{HOSTNAME}.err

 

Munin
Log for munin /var/log/munin

 

Top Memory and CPU Consumers (dcpumon)
Top processes consuming CPU & Memory /var/log/dcpumon/{YEAR}/{MONTH}/{DAY}

 

Web Server (Apache/httpd)
Apache restarts done through cPanel/WHM /usr/local/cpanel/logs/safeapacherestart_log
Domain access logs /usr/local/apache/domlogs/{DOMAIN}
Mod Security /usr/local/apache/logs/modsec_audit.log
Processing of log splitting /usr/local/cpanel/logs/splitlogs_logs
Suexec audit log /usr/local/apache/logs/suexec_log
suPHP audit log /usr/local/apache/logs/suphp_log
Web server & CGI application error log /usr/local/apache/logs/error_log

References

http://go.cpanel.net/logposter

The cPanel Log Files

Share this post:
Page 3 of 9
1 2 3 4 5 9