HostOnNet Blog

Backup Sites Before Terminating on Cpanel Server

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

#!/bin/bash

/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