Backup bash script to back up data, letsencrypt, and export database with Docker (Raspberry Pi) #3500
msawyer91
started this conversation in
Show and tell
Replies: 2 comments
-
Found this while looking for something else related to NPM. Will definitely be implementing this once I have it running. Thanks! |
Beta Was this translation helpful? Give feedback.
0 replies
-
What's the difference to save the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've been wanting to perform a full backup of NPM on my Raspberry Pi, and after googling and finding what needs to be backed up, I thought I'd whip up a little bash script to make it easier. If you have a Raspberry Pi, you know it uses a micro SD card, and these can wear out. I'd hate to lose my NPM implementation and have to rebuild from scratch.
Because files in the "data" and "letsencrypt" folders may have different perms, you should run the provided script with either sudo or set it to run under the root crontab (by running "sudo crontab -e").
When looking at the script I'm providing, please keep in mind these assumptions, and you'll have to tweak path/folder names to suit your configuration. With minor tweaks it should work in Ubuntu, Debian, etc.
How the backup works:
I named the below file backupNginxProxyManager.sh and saved it in /home/pi/scripts. Be sure to run:
That allows the file to be run by bash.
Next, run "sudo crontab -e" -- this edits the root crontab and ensures your script has permissions to access all of the files. Add this line to the bottom of the crontab.
The above will run the script at 23:30 (11:30pm) daily, generating a daily backup of your NPM implementation. It also creates or appends to a logfile so you can troubleshoot any errors.
backupNginxProxyManager.sh
Any feedback, suggestions, etc. are appreciated!
Beta Was this translation helpful? Give feedback.
All reactions