Prevent cpbackup run during the day.

konrath

Well-Known Member
May 3, 2005
366
1
166
Brasil
Hello

Is possible Prevent cpbackup run during the day? Similar to cpanellogd

Generate backups during the day raises much server load.

Thank you
Marcelo
 

konrath

Well-Known Member
May 3, 2005
366
1
166
Brasil
I found something.

for example

kill -STOP <pid> (pause execution)

kill -CONT <pid> (resumes execution)

I will try to create a script to run in cron in order to pause and resume the backup.

If you have suggestions, please share

Thank you
Marcelo
 

konrath

Well-Known Member
May 3, 2005
366
1
166
Brasil
Hello

the script is ready. :D The use of the script is at your own risk. ;)

I installed in /usr/local/bkptime

1) pause backup script

Save to a file (i.e. pause) and put permission 755. Configure cron to the day/hour you want to pause the backup.

Code:
rm -rf pidbackup
rm -rf pids
ps -x > pids
grep /usr/local/cpanel/scripts/cpbackup pids > pidbackup
us=`cut -c1-5 pidbackup`
kill -STOP $us
2) resume backup script

Save to a file (i.e. resume) and put permission 755. Configure cron to the day/hour you want to resume backup.

Code:
rm -rf pidbackup
rm -rf pids
ps -x > pids
grep /usr/local/cpanel/scripts/cpbackup pids > pidbackup
us=`cut -c1-5 pidbackup`
kill -CONT $us

Thank you
Konrath
 
Last edited:

quietFinn

Well-Known Member
Feb 4, 2006
1,905
467
438
Finland
cPanel Access Level
Root Administrator
The time cpbackup runs you can set in root's crontab:

as root do:

crontab -e

you see a line like:

45 4 * * * /usr/local/cpanel/scripts/cpbackup

meaning cpbackup runs every night at 4:45

Change the time and save.
 

konrath

Well-Known Member
May 3, 2005
366
1
166
Brasil
If you can change the cron time to run backups at night, instead, why would you want to pause and resume it?

Because the backup can invade the day. Then you can pause at 6 am and return the next night.

This script is for you to pause the backup after a certain time.

If the backup starts at midnight and take 12 hours to complete, you can pause at 6 am and return next morning.