Results 1 to 12 of 12

Thread: Cpanel backup from command line

  1. #1
    Registered Member This forum account has been confirmed by cPanel staff to represent a vendor. Radio_Head's Avatar
    Join Date
    Feb 2002
    Posts
    2,068

    Default Cpanel backup from command line

    Is there any way to execute a Cpanel weekly ,daily or monthly backup from command line . How to execute them ?


    Thank you
    Stop SPAM & VIRUS :: ASSP Deluxe for cPanel http://www.grscripts.com
    █ ASSP Deluxe is supported by Fritz Borgstedt,ASSP main developer.

  2. #2
    Registered Member This forum account has been confirmed by cPanel staff to represent a vendor. chirpy's Avatar
    Join Date
    Jun 2002
    Location
    Go on, have a guess
    Posts
    13,499

    Default

    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.
    Jonathan Michaelson

    cPanel Server Configuration, Security and Antivirus/AntiSpam Services
    http://www.configserver.com

  3. #3
    Registered Member This forum account has been confirmed by cPanel staff to represent a vendor. Radio_Head's Avatar
    Join Date
    Feb 2002
    Posts
    2,068

    Default

    Thank you!
    Stop SPAM & VIRUS :: ASSP Deluxe for cPanel http://www.grscripts.com
    █ ASSP Deluxe is supported by Fritz Borgstedt,ASSP main developer.

  4. #4
    Registered Member
    Join Date
    Aug 2002
    Posts
    1,193

    Default

    Quote Originally Posted by chirpy
    If it complains about it already have run:

    rm -Rfv /path/to/your/backupdir/cpbackup/daily
    /scripts/cpbackup
    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. #5
    Registered Member This forum account has been confirmed by cPanel staff to represent a vendor. chirpy's Avatar
    Join Date
    Jun 2002
    Location
    Go on, have a guess
    Posts
    13,499

    Default

    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.
    Jonathan Michaelson

    cPanel Server Configuration, Security and Antivirus/AntiSpam Services
    http://www.configserver.com

  6. #6
    Registered Member
    Join Date
    Nov 2006
    Posts
    67

    Default

    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. #7
    Registered Member
    Join Date
    Jun 2004
    Location
    Southern California
    Posts
    255

    Default 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. #8
    Registered Member This forum account has been confirmed by cPanel staff to represent a vendor. chirpy's Avatar
    Join Date
    Jun 2002
    Location
    Go on, have a guess
    Posts
    13,499

    Default

    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
    Jonathan Michaelson

    cPanel Server Configuration, Security and Antivirus/AntiSpam Services
    http://www.configserver.com

  9. #9
    Registered Member
    Join Date
    Nov 2006
    Posts
    67

    Default

    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. #10
    Registered Member
    Join Date
    Jun 2004
    Location
    Southern California
    Posts
    255

    Default

    Quote Originally Posted by chirpy View Post
    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
    awesome, thats what i was looking for! Thanks again Chirpy.

  11. #11
    Registered Member
    Join Date
    Nov 2006
    Posts
    67

    Default

    Hello Dear,
    my problem is with auto take backup

    i settiing in whm for backup

    but can`t take

    and take error

    THanks

  12. #12
    Registered Member
    Join Date
    Mar 2003
    Posts
    18

    Default

    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.


    Quote Originally Posted by robocap View Post
    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";

Similar Threads

  1. How to force backup of ONE account from command line
    By Kent Brockman in forum General Discussion
    Replies: 2
    Last Post: 01-16-2014, 01:09 PM
  2. Reconfigure backup via command line
    By anzenketh in forum Data Protection
    Replies: 2
    Last Post: 08-24-2010, 09:46 PM
  3. Replies: 1
    Last Post: 01-29-2010, 09:04 AM
  4. Creating a Full Backup from the command line?
    By Kadence in forum General Discussion
    Replies: 2
    Last Post: 10-02-2009, 04:41 PM
bargain