Git Product home page Git Product logo

Comments (10)

VictorioBerra avatar VictorioBerra commented on May 26, 2024 1

sudo systemctl start [email protected] worked! Ill check tomorrow and see if it went off at midnight as expected.

from restic-automatic-backup-scheduler.

VictorioBerra avatar VictorioBerra commented on May 26, 2024

More info:

pi@mypi:~$ ls -lah /etc/restic/
total 24K
drwxr-xr-x  2 root root 4.0K May 11 12:56 .
drwxr-xr-x 94 root root 4.0K May 11 11:56 ..
-rw-------  1 root root  139 May 11 11:56 backup_exclude.txt
-rw-------  1 root root 2.1K May 11 12:31 default.env.sh
-rw-------  1 root root 1.7K May 11 12:49 _global.env.sh
-rw-------  1 root root   29 May 11 11:56 pw.txt

This is immediately after running:

$ git clone https://github.com/erikw/restic-automatic-backup-scheduler.git && cd $(basename "$_" .git)

and

sudo make install-systemd

from restic-automatic-backup-scheduler.

erikw avatar erikw commented on May 26, 2024

Hm I would be interested to know what shell is being invoked by your sudo. Not all shells support the source command. This project was written with bash in mind, but is known to will with zsh as well. Plain sh would use the command . instead of source.

from restic-automatic-backup-scheduler.

VictorioBerra avatar VictorioBerra commented on May 26, 2024

@erikw

pi@mypi:~$ echo "$SHELL"
/bin/bash
pi@mypi:~$ source
-bash: source: filename argument required
source: usage: source filename [arguments]
pi@mypi:~$ .
-bash: .: filename argument required
.: usage: . filename [arguments]

from restic-automatic-backup-scheduler.

erikw avatar erikw commented on May 26, 2024

Ok looks good. Does it work to enter an interactive shell and then source? I.e.

$ sudo -s # or sudo -i
# source /etc/restic/default.env.sh

from restic-automatic-backup-scheduler.

VictorioBerra avatar VictorioBerra commented on May 26, 2024

@erikw Yeah it dopes but then im root and commands like rclone fail because it cant find /home/root/.config/rclone etc.

I need to make another issue but my backups aren't running and theres no output at all in journalctl. This is sort of an X-Y problem I suppose since I cant even source to the current shell and test by running /bin/restic_backup.sh

from restic-automatic-backup-scheduler.

VictorioBerra avatar VictorioBerra commented on May 26, 2024

My normal restic command that works is: restic -r rclone:remote:/data1/home/de1913/birdnetpi snapshots

pi@mypi:~/BirdNET-Pi$ sudo -s
root@mypi:/home/pi/BirdNET-Pi# source /etc/restic/default.env.sh
root@mypi:/home/pi/BirdNET-Pi# /bin/restic_backup.sh
B2_ACCOUNT_ID must be set for this script to work.

Did you forget to source a /etc/restic/*.env.sh profile in the current shell before executing this script?
root@mypi:/home/pi/BirdNET-Pi#
root@mypi:/home/pi/BirdNET-Pi# cat /etc/restic/_global.env.sh

# The restic repository encryption key
export RESTIC_PASSWORD_FILE="/etc/restic/pw.txt"
# The global restic exclude file
export RESTIC_BACKUP_EXCLUDE_FILE="/etc/restic/backup_exclude.txt"

export RESTIC_VERBOSITY_LEVEL=1
export RESTIC_NOTIFY_BACKUP_STATS=false
# shellcheck source=etc/restic/_global.env.sh
. "/etc/restic/_global.env.sh"

export RESTIC_REPOSITORY="rclone:remote:/data1/home/de1913/birdnetpi"   # *EDIT* fill with your repo name

# What to backup. Colon-separated paths e.g. to different mountpoints "/home:/mnt/usb_disk".
# To backup only your home directory, set "/home/your-user"
export RESTIC_BACKUP_PATHS="BirdNET-Pi/scripts/birds.db:BirdSongs/Extracted/By_Date/"

# A tag to identify backup snapshots.
export RESTIC_BACKUP_TAG=systemd.timer

# Retention policy - How many backups to keep.
export RESTIC_RETENTION_DAYS=14
export RESTIC_RETENTION_WEEKS=16
export RESTIC_RETENTION_MONTHS=18
export RESTIC_RETENTION_YEARS=3

from restic-automatic-backup-scheduler.

erikw avatar erikw commented on May 26, 2024

This is the key:

root@mypi:/home/pi/BirdNET-Pi# /bin/restic_backup.sh
B2_ACCOUNT_ID must be set for this script to work.

The problem is exactly as the message says. This script is written with using B2 in mind. I see your storage backed is rclone. See here the default profile:
https://github.com/erikw/restic-automatic-backup-scheduler/blob/main/etc/restic/_global.env.sh#L19

To use rclone, you would need to modify the solution just slightly.

If you are lucky, you would just need to remove the B2 envvars from here:
https://github.com/erikw/restic-automatic-backup-scheduler/blob/main/bin/restic_backup.sh#L36

YMMV I've not used the rclone storage backend myself:)

from restic-automatic-backup-scheduler.

VictorioBerra avatar VictorioBerra commented on May 26, 2024

Okay that helped, simply gutting the B2_* stuff from /bin/restic_backup.sh allowed me to run /bin/restic_backup.sh manually and see a successful backup. For rclone, I needed to add the following env vars:

export RCLONE_CONFIG_REMOTENAME_TYPE=sftp
export RCLONE_CONFIG_REMOTENAME_HOST=myuser.rsync.net
export RCLONE_CONFIG_REMOTENAME_USER=myuser
export RCLONE_CONFIG_REMOTENAME_PORT=22
export RCLONE_CONFIG_REMOTENAME_KEY_FILE=/home/pi/.ssh/myuser_rsync_id_rsa

This is because rclone will not be able to find its config when run as root. I suppose I could also move/link the config in roots/.config folder too.

@erikw to test the timer, how can I manually trigger the systemd timer?

from restic-automatic-backup-scheduler.

erikw avatar erikw commented on May 26, 2024

Great, issue resolved:)

@erikw to test the timer, how can I manually trigger the systemd timer?

See
https://github.com/erikw/restic-automatic-backup-scheduler#7-backup-automatically

The --now should run it directly.

It should be possible to start the service manually too, something like

# systemctl start [email protected]

from restic-automatic-backup-scheduler.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.