Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

There is a reseller client with over 100domains under his account. He wants monthly backups done automatically each mont.

The question is, is there a way to backup automatically via cron (or a script manually) every account under his reseller, including his main domain? Can this be done without manually running pkgacct per 100+ domains?

I asked cpanel about this and tech responded with below:

** The file /etc/trueuserowners shows which reseller owns each account. It should be trivial for your system administrator to write a quick for-loop that parses through that file and runs "/scripts/pkgacct $USERNAME /path/to/backup" for each user. **

I don't know how to script such things, but if anyone here can help that would be great. Thanks.

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

use this oneliner to generate the list of users under the reseller 'reseller'.

cat /etc/trueuserowners|grep reseller|cut -d: -f1 > list1.txt

Now list1.txt generated in your pwd contains the list of users under the reseller named 'reseller'. To backup the domains under the reseller to a path /backup, you can run the script:

for i in `cat list1.txt`;do /scripts/pkgacct $i /backup; done
share|improve this answer
add comment

Almost every script you could come up with will be a variant of running cPanel's package account script for every account. There are scripts which can automatically run that script and then will ftp that backup to a remote server, but unless the script is running as the root user on the server, the script is most likely going to need to use cpanel's tools.

If you have root access on the server, I would recommend using the built in WHM tools for making server wide backups.

If you don't have root access, WHMCS has built in tools to manage backups of your reseller account. So does WHMAP. If you are not using either of those as a reseller you might want to look into it, they make a lot of management tasks far easier.

Otherwise I would look at using a simple script like you can find here:

http://www.justin-cook.com/wp/2006/12/27/automatic-cpanel-backup-domain-mysql-with-cron-php/

You will have to set it up for each account and you need to make sure that you don't run all 100 accounts at the same time, that would easily overload the server.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.