Community Forums
Connect with us on LinkedIn
Community Notice
+ Reply to Thread
Results 1 to 12 of 12
  1. #1
    Member This forum account has been confirmed by cPanel staff to represent a vendor. Radio_Head's Avatar
    Join Date
    Feb 2002
    Posts
    2,057

    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
    Super Moderator 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,495

    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

    Need your cPanel servers secured and tuned?
    cPanel Server Configuration, Security, Recovery and Antivirus/AntiSpam Services
    Developers of the most effective (and free) Firewall & Security Solution for cPanel Servers - csf
    http://www.configserver.com

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

    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
    Member
    Join Date
    Aug 2002
    Posts
    1,118

    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
    Super Moderator 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,495

    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

    Need your cPanel servers secured and tuned?
    cPanel Server Configuration, Security, Recovery and Antivirus/AntiSpam Services
    Developers of the most effective (and free) Firewall & Security Solution for cPanel Servers - csf
    http://www.configserver.com

  6. #6
    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
    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
    Super Moderator 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,495

    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

    Need your cPanel servers secured and tuned?
    cPanel Server Configuration, Security, Recovery and Antivirus/AntiSpam Services
    Developers of the most effective (and free) Firewall & Security Solution for cPanel Servers - csf
    http://www.configserver.com

  9. #9
    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
    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
    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
    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 & Tags
Similar threads

  1. Backup command line
    By capture_db in forum Feature Requests for Enkompass
    Replies: 2
    Last Post: 07-06-2011, 04:36 AM
  2. command line backup/restore scripts
    By Goni in forum cPanel and WHM Discussions
    Replies: 5
    Last Post: 03-21-2011, 10:51 AM
  3. Reconfigure backup via command line
    By anzenketh in forum Data Protection
    Replies: 2
    Last Post: 08-24-2010, 10:46 PM
  4. Replies: 1
    Last Post: 01-29-2010, 10:04 AM
  5. Restoring a full backup from command line
    By apc1 in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 04-30-2006, 09:03 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube