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.

Create backup via SSH

Discussion in 'General Discussion' started by moogle, Sep 4, 2006.

  1. moogle

    moogle Well-Known Member

    Joined:
    Apr 7, 2003
    Messages:
    94
    Likes Received:
    0
    Trophy Points:
    6
    Hi, I'm having a brain fart. I can't remember for the life of me.
    What's the command to make a backup in SSH?

    Thanks.
     
  2. Messiah

    Messiah Member
    PartnerNOC

    Joined:
    Jul 5, 2006
    Messages:
    22
    Likes Received:
    0
    Trophy Points:
    1
    /scirpts/pkgacct USERNAME
     
  3. moogle

    moogle Well-Known Member

    Joined:
    Apr 7, 2003
    Messages:
    94
    Likes Received:
    0
    Trophy Points:
    6
    Typo..
    /scripts/pkgacct USERNAME

    For some reason I was thinking /scripts/backup but that felt too simple.
     
  4. Messiah

    Messiah Member
    PartnerNOC

    Joined:
    Jul 5, 2006
    Messages:
    22
    Likes Received:
    0
    Trophy Points:
    1
    If only forums had tab completion...
     
  5. moogle

    moogle Well-Known Member

    Joined:
    Apr 7, 2003
    Messages:
    94
    Likes Received:
    0
    Trophy Points:
    6
    Hey, I found this is backing up the account in the /home calling it cpmove-user.tar.gz
    I'm looking to make it actually back it up, in the /backup/cpbackup folder.
     
  6. Messiah

    Messiah Member
    PartnerNOC

    Joined:
    Jul 5, 2006
    Messages:
    22
    Likes Received:
    0
    Trophy Points:
    1
    If you want to force backups to run, then run /scripts/cpbackup. Keep in mind, this script will only run daily backups if the current daily backup is >=24 hours old, and weekly if the current is >= 7 days old, etc. If you delete the current daily backup for the domain in /backup/cpbackup/daily/, then run /scripts/cpbackup, it will create a new backup file.
     
  7. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,446
    Likes Received:
    195
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    /scripts/cpbackup --force

    to make sure it goes.
     
  8. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,381
    Likes Received:
    23
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    Run:

    /scripts/pkgacct <username> <location> backup

    <username> refers to the username you want to backup.

    <location> is the path to where the backup will be placed (in your case you want to put /backup/cpbackup here).

    backup tells pkgacct that you want to create a backup file. If you leave this off it creates a cpmove archive. Not sure what the difference is between a cpmove and a backup file, but this tells pkgacct you just want to create a <username>.tar.gz file in <location>.
     
  9. freedman

    freedman Well-Known Member

    Joined:
    Feb 13, 2005
    Messages:
    312
    Likes Received:
    1
    Trophy Points:
    18
    if cpbackup has been run already and set up /backup/cpbackup tree, then I use the following script periodically to freshen the user files.

    Note this doesn't update the sql backup, but at least the homedir is up to date (with fresh emails, etc.).. this works for me since most of my clients db usually update on regular intervals and is read the rest of the time.

    #!/bin/sh
    date
    cd /var/cpanel/users
    for i in *; do echo $i `date`; rsync -rlptDuS --del /home/$i/ /backup/cpbackup/weekly/$i/homedir/; done
    date


    I suppose it wouldn't be too difficult to add a line in to backup the databases as well, I've just not bothered.
     
Loading...

Share This Page