Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Prevent cpbackup run during the day.

Discussion in 'Data Protection' started by konrath, Nov 24, 2013.

  1. konrath

    konrath Well-Known Member

    Joined:
    May 3, 2005
    Messages:
    367
    Likes Received:
    0
    Trophy Points:
    166
    Location:
    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
     
  2. konrath

    konrath Well-Known Member

    Joined:
    May 3, 2005
    Messages:
    367
    Likes Received:
    0
    Trophy Points:
    166
    Location:
    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
     
  3. konrath

    konrath Well-Known Member

    Joined:
    May 3, 2005
    Messages:
    367
    Likes Received:
    0
    Trophy Points:
    166
    Location:
    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
     
    #3 konrath, Nov 24, 2013
    Last edited: Nov 24, 2013
  4. quietFinn

    quietFinn Well-Known Member

    Joined:
    Feb 4, 2006
    Messages:
    998
    Likes Received:
    11
    Trophy Points:
    168
    Location:
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. konrath

    konrath Well-Known Member

    Joined:
    May 3, 2005
    Messages:
    367
    Likes Received:
    0
    Trophy Points:
    166
    Location:
    Brasil
    Hello

    This script is to pause and resume the backup.
     
  6. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    16,309
    Likes Received:
    393
    Trophy Points:
    583
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    If you can change the cron time to run backups at night, instead, why would you want to pause and resume it?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. konrath

    konrath Well-Known Member

    Joined:
    May 3, 2005
    Messages:
    367
    Likes Received:
    0
    Trophy Points:
    166
    Location:
    Brasil

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

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice