Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bap backup script #476

Open
wants to merge 14 commits into
base: dev
Choose a base branch
from
59 changes: 59 additions & 0 deletions backup-bap
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/bin/bash
echo -e "\nBAP Backup utility \n"
# Where to backup
BACKUP_PATH="/tmp"
MOUNT_POINT="/media/usb"

# What to backup. remember the \ for new line continuation last line has none
backup_files="${HOME}/pi-build \
${HOME}/.config \
${HOME}/.fl* \
${HOME}/.xastir \
${HOME}/.tqsl \
${HOME}/.wine/drive_c/VARA/VARA.ini \
${HOME}/Desktop \
${HOME}/qsstv \
${HOME}/patmenu2/config \
${HOME}/.local/share/WSJT-X \
${HOME}/.local/share/JS8Call \
${HOME}/.local/share/pat \
${HOME}/.conkyrc \
${HOME}/*.*"

# archive filename
day=$(date +%A)
hostname=$(hostname -s)
archive_file="BAP-Backup-$hostname-$day.tgz"

#make some extra backup notes abnout the repo we have currently
echo -e "\n\nBAP Backup Log for $($BACKUP_PATH/$archive_file)" >> ${HOME}/BAP-backup-log.txt
echo -e "$(git show --pretty=medium | head -7)\n" >> ${HOME}/BAP-backup-log.txt
echo -e "$(git branch)\n" >> ${HOME}/BAP-backup-log.txt

# Print start status message.
echo -e "\nBacking up $backup_files to $BACKUP_PATH/$archive_file \n\n"
date

# Backup the files using tar.
tar czf $BACKUP_PATH/$archive_file $backup_files

echo -e "\nBackup finished\n"
# Long listing of files in $BACKUP_PATH to check file sizes.
ls -lh $BACKUP_PATH/$archive_file

#handle archive or off pi copy

#check if mount point exists
if [ ! -d “MOUNT_POINT” ] ; then
echo -e "\nUSB not found cant copy file off SD-CARD"
echo -e "\nOptional edit backup-bap script to scp off"
exit 1
#scp $BACKUP_PATH/$archive_file username@to_host:/remote/directory/
else
echo -e "\nUSB found"
cp $BACKUP_PATH/$archive_file $MOUNT_POINT

fi

exit 0