Skip to content

Instantly share code, notes, and snippets.

@joshespi
Last active June 5, 2023 18:49
Show Gist options
  • Save joshespi/f9d49ceb9adf33361f4b5a3c4d309dc1 to your computer and use it in GitHub Desktop.
Save joshespi/f9d49ceb9adf33361f4b5a3c4d309dc1 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Creates backup folder if it doesn't exist
mkdir -p /home/pi/backup;
# Moves files to home backup folder
rsync -av --delete /etc/snmp/ /home/pi/backup/snmp
rsync -av --delete /usr/local/bin/ /home/pi/backup/usrlocalbin
rsync -av --delete /etc/rc.local /home/pi/backup/rc.local
rsync -av --delete /boot/config.txt /home/pi/backup/config.txt
rsync -av --delete /etc/hostname /home/pi/backup/hostname
rsync -av --delete /etc/hosts /home/pi/backup/hosts
rsync -av --delete /var/www /home/pi/backup/www
rsync -av --delete /etc/xdg/lxsession/LXDE-pi/autostart /home/pi/backup/chrome_autostart
rsync -av --delete --exclude 'home/pi/.cache/' --exclude 'home/pi/Bookshelf/' --exclude '/home/pi/.config/' --exclude '/home/pi/backup/' --exclude '/home/pi/.vscode-server/' --exclude '.git/' /home /home/pi/backup/home
# Changes file permission on our backup folder so that all the files are seen when we push over SCP
chown -R pi:pi /home/pi/backup/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment