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.nastycode.com
DATE=$(date "+%Y%m%d")
LOCALBACKUP=/backup/$DATE

echo
cd /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
echo
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-src.dmp /usr/src &&
doas /sbin/dump -0 -a -h 0 -f $LOCALBACKUP/usr-obj.dmp /usr/obj &&
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 Going To Take A Hour! Please Keep Calm And Be Patiently Let it Do Its Thing!"
cd /bkup
echo
echo "Starting Upload to Storage VPS Server host.nastycode.com In Folder /home/storage/SplinTer/Backup/partnaz-n-crime.com/$DATE/ On Storage VPS"
echo
/usr/bin/scp -r -i private.key /backup/* splinter@host.nastycode.com:/home/storage/SplinTer/Backup/partnaz-n-crime.com/
echo "Backup Directoy File Size On Backup VPS"
du -sh $LOCALBACKUP
echo
echo "Uploading to $BACKUP_DESTINATION Is Complete! File Path On VPS Server $DATE"
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"