Created
September 4, 2025 18:21
-
-
Save stvhay/f944b331d34767395f7bc15d8c98fadc to your computer and use it in GitHub Desktop.
OPNSense Restic Backup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| set -a | |
| cd /root/restic || { >&2 echo "ERROR: Cannot change into directory."; exit 1; } | |
| read AWS_ACCESS_KEY_ID < AWS_ACCESS_KEY_ID | |
| read AWS_SECRET_ACCESS_KEY < AWS_SECRET_ACCESS_KEY | |
| read RESTIC_PASSWORD < RESTIC_PASSWORD | |
| read S3_ENDPOINT < S3_ENDPOINT | |
| if [ ! -f /root/restic/.init ] | |
| then | |
| if ./restic -r s3:$S3_ENDPOINT init | |
| then | |
| touch .init | |
| echo "Initialized restic repository." | |
| fi | |
| fi | |
| ./restic -r s3:$S3_ENDPOINT backup /usr/local/etc/config.xml | |
| echo "Backup complete." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment