Backup of all accounts on a second drive

I want to set up a cron in nodeworx wich will make a backup of all the accounts (included the MySQL) running on the server and writes them at the second hard on the server. I am thinking to run this cron twice a week. I am a newbe with Linux and don?t know exactly how to set up this cron.
I saw somebody in the forum put a example of the cron he is using. Can somebody give me the modification of the cron below wich will do the job for me?

/home/interworx/bin/backup.pex --domains=all --scp --transfer-ini=/root/scripts/xxx/transfer.ini –

I think all you need to do is remove the –scp --transfer-ini=/root/scripts/xxx/transfer.ini

(What it does is moves the backup to another server using scp, and specifying the scp login info.)

Replace it with the argument:


where the path is what your backup dir is what your second hard drive is mounted as such as


Note, in this example you will need to mount your second hard drive as /backups

Full code for this example:

/home/interworx/bin/backup.pex --domains=all --file-path=/backups

For More Info:

Good Luck :slight_smile:

Does the interworx backup, backup MySQL as well using the suggested code?

no2 vaporizer


It backs up MySQL Dbs as well.


Is there a setting for incremental backups?

no2 vaporizers

The link I gave above provides all of the info that you need (scroll down) but to answer your question:

add the followoing parameters to the code above

–web for website data (the contents of your html directory)
–mail for your email accounts and all of the email in them
–databases for just the databases

for example:

/home/interworx/bin/backup.pex --domains=all --databases --file-path=/backups

this will provide the command to back up all of your databases accounts assigned to siteworx accounts.


Oh, and before I forget, before doing this take a look at the size of your temp directory (if it is it’s own partition) and the size of the domains that you intend to back up – since you’re doing all of the domains.

If it’s extra small you may meed to implement the workaround in the link below to get this to work.

I know the simple answer to the question Im about to ask is a yes, but what I want to know is can I serve the same purpose…

Is doing a rsync backup to a second hard drive any different than doing an Iworx backup to a second hard drive in the case of a total hard drive failure?

I understand that it will be much easier to restore an account to a previous state with individual backups, but what about the case where you want to move to another server for example or if your main hard drive decides to stop working one day.

If I backup the entire home directory I should get all the Iworx databases for all the SiteWorx accounts plus all the account files under their own home directories.

Then I also backup the /var/mysql to get all the siteworx user databases.

If I wanted to restore I could just copy my backup of /home and /var/lib/mysql and I should be back up an running right… Iworx and all?

I also backup /etc.

Now I understand if I wanted to move from RH9 to CentOS it would be much easier to just do a NodeWorx backup and then a restore, but if going from the same OS to same OS it should be okay?

Thanks for the feedback

What version of Iworx are you running?

If the box was provisioned with 2.1 InterWorx and it’s database is now located in:


and if it was provisioned with 2.0 and you have jailed shells set up /home is really


yes there is a symlink but I don’t think rysinc will follow the symlink


Thanks for the info. I’ve had Iworx for over a year now so it’s way before 2.0. I never did the jailed shell and just confirmed that the Iworx DBs are under the /home/interworx/var/lib/mysql.

So with my current backup I should be able to do a complete restore correct?

Im tgz’n one of my backups now and going to download it and overwrite a test box I have and see if works out the way it should.

Part of the reason I want to know is that doing and rsync is much easier on the server than doing a SiteWorx backup which creates TGZs, really the only load of the rsync is before the rsync I copy the previous nights rsync to another folder so I can have multiple days of backups.

I know you’re a long time custome I just wanted to make sure it wasn’t a new box :slight_smile:

Anyway, theoretically it would work – you seem to have all of the important files – but it’s not quite as easy as copying back the files I think. That might better be addressed by Chris, Paul, or one of the others.

A year ago I was migrating servers and was going to try the same thing (before the current backup sustem) and Chris and Sochat saved me from it by letting me beta test an early version of the backup/restore sustem instead. It’s your choice but this seems like a big mess to me :slight_smile:

Something else occured to me last night after I wene to bed that I wanted to make sure to point out to you:

It’s my understanding that you want to be able to do a restore on the box to get all of your general settings and the InterWorx database up and running and then restore the individual SiteWorx accounts from backup files.

If you do that, when you do the restore from backup files it will abort in error because the data for that account is already in the Iworx tables.

So you would need to do a restore one way or the other, you can’t do a conblomeration of both.

Socheat, our resident backup/restore guru can correct me if I’m wrong :slight_smile:

I know I am not the clearest at times, but what you said above is what I want to do. I dont want to mix and match I want to do the following with my backed up files:

  1. Copy back all the user /home directory files
  2. Copy back to /var/lib/mysql all the user MySQL DBs
  3. Restore the Iworx DBs in /home/interworx/var/lib/mysql
  4. Then I can carefully restore any file from /etc. For example all the /etc/httpd/conf.d files.

The real reason I want to do this is so that I can do incremental backups with rsync. Because I do a nightly backup and if not a lot of files change then it’s really quick. Also, doing rsync I’m not tar’n or gzip’n anything so it only takes about 20 mins to do the “cp /backup/0 /backup/1” and the rsync. If I wanted to backup all SiteWorx accounts plus /etc it would take a while and put one hell of a load on my basic server, TGZ’n isn’t the CPU’s best friend.

The only time consuming part is that I copy the previous nights backup from /backup/0 to /backup/1. This way /backup/0 still contains the files for the rsync compare (incremental) and I also have a copy of the previous nights backup. I keep serveral days not so much for hard drive failure protect but I accidentally deleted a file 3 days ago and just noticed now protection.

With rsync it then gives me two options for off site backup.

  1. TGZ the whole /backup/0 folder which would be serveral gigs in one file.
  2. Do a remote rsync to an offsite server which would only need to update changed files.

Any ideas or opinions of why this is good or bad are welcome.

Thanks! :smiley:

Also, I will be trying this with my test box. I TGZ’d one of my rsync backups and have already downloaded it to my main windows PC. I lost a UPS after Wilma came through so I’m short on outlets, but I will be getting a new one by Friday and will fire up the test linux box and will post my results here. Im going to try the above steps and see what happens :eek:

You should have all of the key files you need there – yes.


It’s old but I’d like to let you know ^m not sure you’ll have ALL the files to do the restore.
What about mails and mail config ?
/var/vpopmail (not sure for this one as there is some symlinks as every entry in domains/ is linked from /home//var//mail/)


That would be good to have in a complete server failure. But as of today there is no NodeWorx backup, so even if you backup the qmail setup folder, it might not help b/c some settings are in the NodeWorx database.

I’ve dediced the best thing to do for backups is tell your hard drives to not die :stuck_out_tongue:

Hello Justec,

Well in fact here is what we backup :

/usr/local/interworx (so all soft and datbase)
/etc/passwd /etc/group /etc/shadow /etc/hosts.allow /etc/hosts.deny /etc/resolv.conf /etc/hosts /etc/proftpd.conf

In fact we do not tar or rsync /home, we create a full backup with iworx backup tool. As in every backup file there is in it a tar file containing the /home files and the database we can extract the tar file of home files from this backup file.

Why we do this :

  • In case of siteworx accounts problem we can just restore this account
  • In case of /home corruptions we can extract all /home tar files from iworx backup files (we have a script that do this)
  • In case of database pbm, we can choose between restore the database files from the :
    a) a siteworx backup account
    b) all siteworx baclup accounts
    c) our backup of /var/lib/mysql
  • In case of interworx corruption. We can choose to reinstall or restore the /usr/local/intterworx and to restore the interworx database and the iworx.ini file
  • In case of a complete migration : We can use all home the tar files contained in every siteworx account backups, restore mysql users databases, restore interworx database file and iworx.ini file and qmail config and etc conf files
  • In case of drive failure : we have hardware raid 1, so…

I think we found the best compromit. The problem we had is to choose between :
-a- do a backup off all siteworx accounts and all others data WITHOUT /home
-b- do a backup off all siteworx accounts and all others data WITH /home
-c- Do not perform a siteworx backup and only perform rsync or whatever of all needs files

The b method should be the best one, but it is really time, cpu, load average usage consumming. Do a full rsync or tar of /home is heavy and perform a full siteworx backup too.

So we thought of only perform a siteworx backup, + all others files without /home. We just have to find a way to extract fron every siteworx account the /home backup file.

This method is not the best one, but one more time do a backup off siteworx accounts and /home is really usage consumming.

The --only-structure option in backup could help, but we think it may be very usefull to also have a full siteworx backup.

Well in fact the best could be, to analyse all the possibilities of failure and found the best compromit for an easy and less time restore. If we do a full list of what might happend and try to find the best solution for every ones we maybe could find the best to way of backup.

All interworx users, staff may help and try to give a “red book” of the best backup of interworx box

The list of what may happen

  • Siteworx Accounts failure
  • Interworx failure
  • Vital directory compromised or vital data lost (which are they)
  • drive failure
  • server migration

This list in not exhaustive and may be completed

Maybe interworx team might tell us what are they backup and recovery plan at Nexcess.