The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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:
    16
    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:
    16
    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:
    16
    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:
    10
    Trophy Points:
    18
    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.
     
  5. konrath

    konrath Well-Known Member

    Joined:
    May 3, 2005
    Messages:
    367
    Likes Received:
    0
    Trophy Points:
    16
    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:
    14,472
    Likes Received:
    200
    Trophy Points:
    63
    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?
     
  7. konrath

    konrath Well-Known Member

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