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.

Run a command after a finished Backup

Discussion in 'Data Protection' started by asturmas, Aug 23, 2008.

  1. asturmas

    asturmas Well-Known Member
    PartnerNOC

    Joined:
    Jun 19, 2006
    Messages:
    138
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Portugal
    cPanel Access Level:
    DataCenter Provider
    Hi guys,

    I want to run a rsync command or sh file (as you wish) to backup all the data that's in the /backup dir after cpbackup has finished. Another thing I would ask for an adive of a good rsync -(strings) command. Because I'm a bit confused.

    Regards
     
  2. jayh38

    jayh38 Well-Known Member

    Joined:
    Mar 3, 2006
    Messages:
    1,215
    Likes Received:
    0
    Trophy Points:
    36
    You would need to provide more detail for your task.

    Are you syncing to a different machine or other directory. Is the other machine on a lan etc etc..

    Provide more detail.
     
  3. subin_hutton

    subin_hutton Member

    Joined:
    Jul 25, 2008
    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    India
    Hi,

    If you want you can run a script to take complete back up of all the accounts in your server and then rsync it to the destination server.For rysnc you can use the following syntax

    rsync --progress -e 'ssh -p portnumber' <source> <destination>

    eg:rsync --progress -e 'ssh -p 7277' /backup 192.168.0.150:/cpbackup

    Cheers
     
  4. asturmas

    asturmas Well-Known Member
    PartnerNOC

    Joined:
    Jun 19, 2006
    Messages:
    138
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Portugal
    cPanel Access Level:
    DataCenter Provider
    Hi,

    The machine is in the LAN network. Connected with a 1gbit CrossOver cable. I want to edit "cpbackup" file to make him do a rsync command.

    regards
     
  5. brianoz

    brianoz Well-Known Member

    Joined:
    Mar 13, 2004
    Messages:
    1,146
    Likes Received:
    6
    Trophy Points:
    38
    Location:
    Melbourne, Australia
    cPanel Access Level:
    Root Administrator
    There may be a way to do it within cpbackup, but I'm not sure there is.

    One easy way to do it though is to add your second command onto the end of the cpbackup line in crontab.

    ie: crontab -e -- old line:
    Code:
    0 1 * * * /scripts/cpbackup
    
    -- new line:
    Code:
    0 1 * * * /scripts/cpbackup; /usr/local/bin/my_rsync
    
     
  6. d_t

    d_t Well-Known Member

    Joined:
    Sep 20, 2003
    Messages:
    243
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Bucharest
    No, any change in that file will be overwritten at next cpanel update.
    You can add any command in /scripts/postcpbackup Create it if does not exists and set execute permission.
     
Loading...

Share This Page