HostOnNet Blog

Backup Sites Before Terminating on Cpanel Server

Looking for Linux Server Admin or WordPress Expert? We can help.

I wanted to create a backup of user sites before it get terminated on cpanel servers. This will help in case of an accidental site deletion or customer want to activate the site after it is terminated. We always keep sites suspended for 1 Month before removing it from the server, we had few customers who come back after few months and ask for account restore.

Having accounts backed up just before termination, we will have the latest backup available for customer in case required.

To enable account backup before termination, edit/create file file

vi /usr/local/cpanel/scripts/prekillacct

Add following content


/usr/local/cpanel/scripts/pkgacct "$@"

Make the file executable

chmod 755 /usr/local/cpanel/scripts/prekillacct

Now every time a site is terminated, a backup will be generated in /home folder.

Posted in Cpanel Server

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.