1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Cpanel backup from command line

Discussion in 'General Discussion' started by Radio_Head, Jul 27, 2006.

  1. Radio_Head

    Radio_Head Active Member

    Joined:
    Feb 15, 2002
    Messages:
    2,066
    Likes Received:
    1
    Trophy Points:
    38
    Is there any way to execute a Cpanel weekly ,daily or monthly backup from command line . How to execute them ?


    Thank you
     
  2. chirpy

    chirpy Super Moderator

    Joined:
    Jun 15, 2002
    Messages:
    13,499
    Likes Received:
    14
    Trophy Points:
    38
    Location:
    Go on, have a guess
    The weekly and monthly backups are created based on the date of the previous run. Weekly and Monthly backups are simply copies of the current daily.

    So, to run a new daily:

    /scripts/cpbackup

    If it complains about it already have run:

    rm -Rfv /path/to/your/backupdir/cpbackup/daily
    /scripts/cpbackup


    To rerun the weekly:

    rm -Rfv /path/to/your/backupdir/cpbackup/daily
    rm -Rfv /path/to/your/backupdir/cpbackup/weekly
    /scripts/cpbackup


    etc.
     
  3. Radio_Head

    Radio_Head Active Member

    Joined:
    Feb 15, 2002
    Messages:
    2,066
    Likes Received:
    1
    Trophy Points:
    38
    Thank you!
     
  4. sparek-3

    sparek-3 Active Member

    Joined:
    Aug 10, 2002
    Messages:
    1,217
    Likes Received:
    4
    Trophy Points:
    38
    Actually, I think you can just run:

    /scripts/cpbackup --force

    and it will ignore whether or not the daily backup has been written to today. I may be wrong, someone can double check me.
     
  5. chirpy

    chirpy Super Moderator

    Joined:
    Jun 15, 2002
    Messages:
    13,499
    Likes Received:
    14
    Trophy Points:
    38
    Location:
    Go on, have a guess
    Looking at the script, it looks like it does use --force, don't know how long that's been there ;) However, a word of warnnig, the script appears to show that if you do that it will automtaically do the daily and weekly and monthly if they're configured. So, if you only want to rerun the daily, don't use --force.
     
  6. robocap

    robocap Member

    Joined:
    Nov 6, 2006
    Messages:
    67
    Likes Received:
    0
    Trophy Points:
    6
    Hello,
    will time i run /scripts/cpbackup or /scripts/cpbackup --force take to me one error


    root@server [/]# /scripts/cpbackup
    Backup is not done today as per whm backup settings at /scripts/cpbackup line 164.


    line 164 is


    localtime(time);
    $backupthisday = 0;

    foreach (@BACKUPDAYS) {
    if($wday eq $_) {
    $backupthisday = 1;
    }
    }

    if (!$backupthisday) {
    die "Backup is not done today as per whm backup settings";
    }
    }

    my $basedir = $CONF{'BACKUPDIR'};
    if ($CONF{'BACKUPTYPE'} eq "ftp") {
    mkdir("/home/cpbackuptmp",0711);
    chmod(0711,"/home/cpbackuptmp");
    $basedir = "/home/cpbackuptmp";
    if ($CONF{'BACKUPTYPE'} eq "ftp") {
    $CONF{'BACKUPINC'} = "no";
    $CONF{'BACKUPFILES'} = "no";

    Pease help me
     
  7. t9clkclnr

    t9clkclnr Member

    Joined:
    Jun 11, 2004
    Messages:
    254
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Southern California
    vars to pass for single account backup from command line

    Are there any commands i can pass to the /scripts/cpbackup via a command line that will execute a backup for a single account?

    This would be most beneficial. Moving a single account from a server to another, i don't want to wait for the backs to run at night, and don't want to run the entire backup cron for all accounts.

    Anyone?
     
  8. chirpy

    chirpy Super Moderator

    Joined:
    Jun 15, 2002
    Messages:
    13,499
    Likes Received:
    14
    Trophy Points:
    38
    Location:
    Go on, have a guess
    If you want to move one account use:

    /scripts/pkgacct accountname

    This creates a backup of the account at the top level of /home which you can copy over to another server into /home and restore using:

    /scripts/restorepkg accountname
     
  9. robocap

    robocap Member

    Joined:
    Nov 6, 2006
    Messages:
    67
    Likes Received:
    0
    Trophy Points:
    6
    Do you can help me?

    will time i run /scripts/cpbackup or /scripts/cpbackup --force take to me one error


    root@server [/]# /scripts/cpbackup
    Backup is not done today as per whm backup settings at /scripts/cpbackup line 164.


    line 164 is


    localtime(time);
    $backupthisday = 0;

    foreach (@BACKUPDAYS) {
    if($wday eq $_) {
    $backupthisday = 1;
    }
    }

    if (!$backupthisday) {
    die "Backup is not done today as per whm backup settings";
    }
    }

    my $basedir = $CONF{'BACKUPDIR'};
    if ($CONF{'BACKUPTYPE'} eq "ftp") {
    mkdir("/home/cpbackuptmp",0711);
    chmod(0711,"/home/cpbackuptmp");
    $basedir = "/home/cpbackuptmp";
    if ($CONF{'BACKUPTYPE'} eq "ftp") {
    $CONF{'BACKUPINC'} = "no";
    $CONF{'BACKUPFILES'} = "no";
     
  10. t9clkclnr

    t9clkclnr Member

    Joined:
    Jun 11, 2004
    Messages:
    254
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Southern California
    awesome, thats what i was looking for! Thanks again Chirpy.
     
  11. robocap

    robocap Member

    Joined:
    Nov 6, 2006
    Messages:
    67
    Likes Received:
    0
    Trophy Points:
    6
    Hello Dear,
    my problem is with auto take backup

    i settiing in whm for backup

    but can`t take

    and take error

    THanks
     
  12. qkslvr

    qkslvr New Member

    Joined:
    Mar 2, 2003
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    Check the backup settings. It is required that the day you run backup is also set to be allowed from with whms backup conf section.


     

Share This Page