From a0e5de3bd2a110426d73b23b07035f007a38e122 Mon Sep 17 00:00:00 2001 From: buildplan Date: Sat, 18 Oct 2025 22:18:01 +0100 Subject: [PATCH 1/3] fix: Add default PATH to ensure cron execution --- restic-backup.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/restic-backup.sh b/restic-backup.sh index 0264513..2fbae58 100644 --- a/restic-backup.sh +++ b/restic-backup.sh @@ -1,14 +1,15 @@ #!/usr/bin/env bash # ================================================================= -# Restic Backup Script v0.38.2 - 2025.10.08 +# Restic Backup Script v0.38.3 - 2025.10.18 # ================================================================= +export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin set -euo pipefail umask 077 # --- Script Constants --- -SCRIPT_VERSION="0.38.2" +SCRIPT_VERSION="0.38.3" SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) CONFIG_FILE="${SCRIPT_DIR}/restic-backup.conf" LOCK_FILE="/tmp/restic-backup.lock" From a8e9587140fb284a2020a61ea1311dc2f73d1855 Mon Sep 17 00:00:00 2001 From: buildplan Date: Sat, 18 Oct 2025 22:22:02 +0100 Subject: [PATCH 2/3] sha256 for v0.38.3 --- restic-backup.sh.sha256 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/restic-backup.sh.sha256 b/restic-backup.sh.sha256 index de3fe1b..a023f7a 100644 --- a/restic-backup.sh.sha256 +++ b/restic-backup.sh.sha256 @@ -1 +1 @@ -84a7b2750793953abf94aea82971596fedad1cb4382f1ad6264bae3ba66ecc65 restic-backup.sh +568618563ca890afec48f97cb9bc88fc36d2735cd4d031951713ea4bdd8e4806 restic-backup.sh From ec67c906dddb98da08e1b4776df3c79d1710745d Mon Sep 17 00:00:00 2001 From: buildplan Date: Sat, 18 Oct 2025 22:29:51 +0100 Subject: [PATCH 3/3] remove default PATH from cron example --- README.md | 47 ++++++++++++++++++++++------------------------- 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 13aabff..2f07b4e 100644 --- a/README.md +++ b/README.md @@ -36,39 +36,39 @@ For those familiar with setting up backup scripts, here is a fast track to get y 1. **Download files** -```sh -mkdir -p /root/scripts/backup && cd /root/scripts/backup -curl -LO https://raw.githubusercontent.com/buildplan/restic-backup-script/refs/heads/main/restic-backup.sh -curl -LO https://raw.githubusercontent.com/buildplan/restic-backup-script/refs/heads/main/restic-backup.conf -curl -LO https://raw.githubusercontent.com/buildplan/restic-backup-script/refs/heads/main/restic-excludes.txt -chmod +x restic-backup.sh -``` + ```sh + mkdir -p /root/scripts/backup && cd /root/scripts/backup + curl -LO https://raw.githubusercontent.com/buildplan/restic-backup-script/refs/heads/main/restic-backup.sh + curl -LO https://raw.githubusercontent.com/buildplan/restic-backup-script/refs/heads/main/restic-backup.conf + curl -LO https://raw.githubusercontent.com/buildplan/restic-backup-script/refs/heads/main/restic-excludes.txt + chmod +x restic-backup.sh + ``` 2. **Edit configuration** -- Update `restic-backup.conf` with repository details, backup sources, and password file. -- Secure it: `chmod 600 restic-backup.conf` + - Update `restic-backup.conf` with repository details, backup sources, and password file. + - Secure it: `chmod 600 restic-backup.conf` 3. **Create password and initialize repository** -```sh -# Create the password file (use a strong, unique password) -echo 'your-very-secure-password' | sudo tee /root/.restic-password -sudo chmod 400 /root/.restic-password + ```sh + # Create the password file (use a strong, unique password) + echo 'your-very-secure-password' | sudo tee /root/.restic-password + sudo chmod 400 /root/.restic-password -# Initialize the repository -sudo ./restic-backup.sh --init -``` + # Initialize the repository + sudo ./restic-backup.sh --init + ``` 4. **First backup and schedule** -```sh -# Run the first backup with verbose output -sudo ./restic-backup.sh --verbose + ```sh + # Run the first backup with verbose output + sudo ./restic-backup.sh --verbose -# Set up a recurring schedule via wizard (systemd or cron) -sudo ./restic-backup.sh --install-scheduler -``` + # Set up a recurring schedule via wizard (systemd or cron) + sudo ./restic-backup.sh --install-scheduler + ``` > Default log: `/var/log/restic-backup.log` @@ -532,9 +532,6 @@ If you prefer to manage the schedule manually instead of using the wizard, you c 2. Add the following lines to schedule your backups and maintenance. ```crontab - # Define a safe PATH that includes the location of restic - PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin - # Run the Restic backup every day at 3:00 AM 0 3 * * * /root/scripts/backup/restic-backup.sh > /dev/null 2>&1