Skip to main content

Any way to make backups require less transient space?

Comments

3 comments

  • Ishware
    I forgot to look for /scripts/ solutions. And of course /scripts/pkgacct exists. I'll leave this thread up for anyone else who looks for an answer like this. I'll also share the bash script I'm working on when I get it done. :)
    0
  • Ishware
    Here's what I have so far. I have it as an alias in .bash_aliases for now, but I plan to move it to the server and run via cron. I also will write a script later that will deal with previous backups, but for now, this is a start:
    backupserver () { fdir=`date +%Y-%m-%d` ssh -t -n -o LogLevel=QUIET user@backupserver.ext "mkdir /backups/$fdir" &>> ~/.backups.$fdir.txt while read line; do echo "Packaging $line"" echo "__________________________________________________________________" &>> ~/.backups.$fdir.txt echo -e "$line:" &>> .backups.$fdir.txt ssh -t -n root@mainserver.ext[/EMAIL] "/scripts/pkgacct $line --dbbackup=all /backups/$fdir" &>> ~/.backups.$fdir.txt echo "Transporting $line"" ssh -t -n root@mainserver.ext -t "scp /backups/$fdir/cpmove-$line.tar.gz user@backupserver.ext:/backups/$fdir/" &>> ~/.backups.$fdir.txt ssh -t -n root@mainserver.ext -t "rm /backups/$fdir/cpmove-$line.tar.gz" &>> ~/.backups.$fdir.txt echo -e "\n\n" &>> ~/.backups.$fdir.txt done < ~/.mainserveraccts.txt }
    Note that ~/.mainserveraccts.txt consists of a list of usernames I want to backup. As I create new accounts, I'll add them to the list. I also don't worry if the backups/[date] folder exists or not - it throws an error that it does if it does, and big whoop. Also, running this twice in one day will of course overwrite the backups, which may or may not be your desire. And you'll want to change user@backupserver.ext[/EMAIL] and root@mainserver.ext[/EMAIL] to match your two actual user@servers. And adjust the log name if you want. If you have suggestions/improvements, please share. :)
    0
  • cPanelMichael
    Hello :) Thank you for taking the time to post your solution for others to see. Note that Pkgacct is documented at: /scripts/pkgacct " Package a cPanel Account - Documentation - cPanel Documentation There's also a feature request here that may interest you: Prevent WHM Back-Up from Crashing Servers / Using All Disk Space Thank you.
    0

Please sign in to leave a comment.