Dump Backup With SCP

this is a custom shell script to run dump command for backup to remote server with the SCP Command with using a private openssh key! please note that you will need to setup private.key for your scp to use without using a password

NOTE: The above command copies the backup from local host to remote host to store your backup. This requires ssh without password (ssh keys) and doas without password which is a security concern

private.key NOTE: The Solution: When you get to the public key screen in creating your key pair in puttygen, copy the public key and paste it into a text file with the extension .pub. You will save you sysadmin hours of frustration reading posts like this

Begin of script


#!/bin/sh 
#Author SplinTer@NaStYcOdE.Com Free Unix Tech Support At support@nastycode.com
# Join Us On IRC At IRC.NaStYcOdE.COM Channel #NaStYcOdE
SHELL=/bin/sh
PATH=/bin:/sbin19:/usr/bin:/usr/sbin19:/sbin/:/usr/sbin
HOME=/root
MAILTO="splinter@NaStYcOdE.com"
HOSTNAME=NaStYcOdE.COM
BACKUP_DESTINATION=SplinTer@host.planetofnix.com
DATE=$(date "+%Y%m%d")
LOCALBACKUP=/home/backup/$DATE

echo
cd /home/backup/
echo
mkdir $DATE
echo
cd $LOCALBACKUP
echo "Curremt Working Backup Directory $LOCALBACKUP on $hostname"
echo
echo "Partition's Needs Backed Up With OpenBSD Dump And SCP Command"
echo
df -h
echo
echo "Current Backup Location $HOSTNAME VPS Folder $LOCALBACKUP"
echo
cd $LOCALBACKUP
doas /sbin/dump -0 -a -h 0 -f $LOCALBACKUP/root.dmp / &&
doas /sbin/dump -0 -a -h 0 -f $LOCALBACKUP/tmp.dmp /tmp &&
doas /sbin/dump -0 -a -h 0 -f $LOCALBACKUP/usr.dmp /usr &&
doas /sbin/dump -0 -a -h 0 -f $LOCALBACKUP/usr-X11R6.dmp /usr/X11R6 &&
doas /sbin/dump -0 -a -h 0 -f $LOCALBACKUP/usr-local.dmp /usr/local &&
doas /sbin/dump -0 -a -h 0 -f $LOCALBACKUP/var.dmp /var &&
doas /sbin/dump -0 -a -h 0 -f $LOCALBACKUP/home.dmp /home &&
echo "Folder Size Of Backup On $HOSTNAME VPS"
cd $LOCALBACKUP
du -sh
echo
echo "Uploading to $BACKUP_DESTINATION Backup Server! User Account SplinTer!"
echo
echo "Uploading to $BACKUP_DESTINATION Going To Take A Hour! Please Keep Calm And Be Patiently Let it Do Its Thing!"
cd /home/backup
echo
echo "Starting Upload to Storage VPS Server host.planetofnix.com In Folder /mnt/sd4/a/vps/SplinTer/backup/nastycode.com/$DATE On Storage VPS"
echo
/usr/bin/scp -r -i private.key /home/backup/* SplinTer@host.planetofnix.com:/mnt/sd4/a/vps/SplinTer/backup/nastycode.com/
echo "Backup Directoy File Size On Backup VPS"
du -sh /home/backup/$DATE
echo
echo "Uploading to $BACKUP_DESTINATION Is Complete! File Path On VPS Server /home/backup/sd4/a/vps/SplinTer/backup/nastycode.com/"
echo
echo
echo "Deleteing $HOSTNAME Files From local Backup! Current Directory $LOCALBACKUP"
rm -fr $LOCALBACKUP
echo
echo
echo "This Bash Script Can Be Run As Ofen As You Wish! I'd Run At Least Weekly! Made By SplinTer@NaStYcOdE.Com"