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
function 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.