I want to spread out the backup process over a longer period of time to lower the load on the box.


Enter Your Query:
Use '%' for wildcards and quotes for "exact phrases"


Top Level » DirectAdmin » Backup & Restore Process

I want to spread out the backup process over a longer period of time to lower the load on the box.Last Modified: Jan 12, 2011, 12:16 am
If you wish to keep your load average below a certain point, and not allow backups to run right away if the load is over a certain point, the followin script will help.  It will check your load average before each backup file is created. If the load is too high, it will wait for 5 seconds, then check again.  It will continue this process until the load is low enough, then create the backup.  If the load is not below the threshold after 20 attempts, a non-zero value is returned and that user backup is skipped and an error returned in DA.

To use this script, place the following code into the file:

/usr/local/directadmin/scripts/custom/user_backup_pre.sh

#!/bin/sh
MAXTRIES=20
MAXLOAD=8.00

highload()
{
          LOAD=`cat /proc/loadavg | cut -d\  -f1`
          echo "$LOAD > $MAXLOAD" | bc
}

TRIES=0
while [ `highload` -eq 1 ];
do
          sleep 5;
          if [ "$TRIES" -ge "$MAXTRIES" ]; then
                    echo "system load above $MAXLOAD for $MAXTRIES attempts. Aborting.";
                    exit 1;
          fi
          ((TRIES++))
done;
exit 0;

then chmod the new user_backup_pre.sh script to 755.

Related:
http://www.directadmin.com/features.php?id=978
 
Related Helpfiles
I want to skip a lot of the User data when creating backups
How to slow down the rate of backup to reduce load and to not flood a remote ftp server

© 2018 JBMC Software, Suite 173  3-11 Bellerose Drive, St Albert, AB  T8N 1P7  Canada.  Mon-Fri 9AM-5PM MST