Press "Enter" to skip to content

Category: Net: Techy: cPanel

Posts about the cPanel control panel system

cPanel: Simple Script To Backup Over rSync

If you are running a reasonably recent version of cPanel (I think v11 or later), you have the ability to run WHM backups over rsync instead of just FTP. This post, if it isn’t obvious, is intended for people with root access to their cPanel server.

So how do you do this?

Simple, configure the backups as per normal in WHM to backup your secondary hard drive or a set partition on your main hard drive. Then just add a script via the shell command line as “/scripts/postcpbackup” (open PuTTY, connect to the server, login, “su” to root if necessary if you didn’t login as root, type “nano -w /scripts/postcpbackup”) and past the following script:

rsync -vrplogDth /backup/cpbackup/* username@backupserver:/backuplocation/

Replacing “/backup/cpbackup/” with the location of your “local backups” if you changed it from the default, “username” with the username of your rSync account, “backupserver” with the hostname/IP address of the backup server and “backuplocation” of the place to store the backups. (It’s CTRL+X to exit nano by the way).

You then just need to make it executable by running “chmod a+x /scripts/postcpbackup” and you are done!

Hope it helps someone!

cPanel: cPanel 11 and WebDav

As some of you may be aware, the new version of cPanel (version 11) now supports a technology called “WebDav” (known as “Web Disks” within cPanel).

Basically this allows you to setup your cPanel web hosting account as an additional drive on your machine – making the uploading and publishing of files a lot easier.

However, server administrators will first need to enable the TCP ports 2077 and 2078 in and outbound for this to work correctly (don’t forget to restart/reload the firewall). Once that’s done, your customers should be able to login to their cPanel control panel and either select the new fancy “Getting Started” wizard or “Web Disks->Access Web Disk” to setup a link.

Using cPanel’s handy “Auto configuration” tool is useful – but you may hit the same problem I did when I downloaded the installer .vbs file to my Windows XP machine via Firefox. Attempting to open the file came up with the error “Windows Script Host access is disabled on this machine. Contact your administrator for details”. Needless to say – I am the administrator and if I’ve disabled something like that in the past, it’s probably for a very good reason!

So – how can we manually configure cPanel’s WebDav uploading tool manually if the automatic method fails?….

Techy: Dealing with .tar.gz, .gz and .zip files on a cPanel Server

Many of you with cPanel web hosting accounts would have needed to upload files to a cPanel server which were in .tar.gz, .gz or .zip files (these are compressed archives).

And I bet many of you would like to have been able to upload the archives to the server “as is” (to save decompressing them on your machine and then having to slowly upload each and every file).

But did you know there is actually a “cheat” for this?

Just upload the files to your webspace via FTP (or via the cPanel File Manager) as per usual. Then login to your cPanel control panel and select “File Manager” (if you are running on the new x3 theme with cPanel 11, it doesn’t matter if you select “File Manager” or “Legacy File Manager”). Select the archive you uploaded, and then click “Decompress” from the top menu (on the new file manager) or “Extract from Archive” from the right hand menu (on the old file manager) and there you go.

Your files are now decompressed on the server quickly and simply!

Techy: Outdated Coppermine Finder

Whilst on the subject of outdated cPanel based things, I’ve just put together a quick little script to scan a cPanel based webserver for outdated Coppermine Photo Gallery installations.

As the notes state, the script isn’t pretty, it isn’t efficient, but it works.

Comments/feedback are appreciated.
Coppermine Gallery Outdated installation checker v0.01

Set $disableandemail to 1 to disable the scripts and email the users.

Techy: cPanel DNS Cleardown script

Do you have many “old” cPanel servers? Perhaps you have the cpanel servers configured in a DNS cluster for redudancy? If so, you may encounter the same problem as I did where you have “stale” (or old) DNS zones cluttering up the server. Here’s a script to get rid of any unused zone files (use at your own risk yadda yadda yadda – you will have to rebuild /etc/named.conf afterwards):