News for hackers. Stuff that matters.
Re:Backblaze B2 Cloud Storage Now Has S3 Compatible APIs by qmmmur on Monday May 04, 2020 @12:33PM (#23070069)
Do you automate your process somehow? I'm trying to develop a strategy where if I open my laptop after a certain time it backups in the background. My go to for this kind of thing was hammerspoon but it won't execute the shell task in the background thread and completely locks my machine. I guess I could cron it?
Re:Backblaze B2 Cloud Storage Now Has S3 Compatible APIs by l3s2d on Monday May 04, 2020 @01:38PM (#23070950)
I use a systemd user service. It sounds like you're on OS X, so you won't have systemd. Cron should work.

Here are my systemd files for reference.

Service:

  [Unit]
  Wants=network-online.target
  After=network-online.target

  [Service]
  Type=simple
  ExecStart=/bin/bash -c "/usr/bin/restic unlock && /usr/bin/restic backup --verbose --one-file-system --exclude-caches --exclude=$XDG_CACHE_HOME %h && /usr/bin/restic forget --keep-last 5 --prune && /usr/bin/restic cache --cleanup --max-age 30"

  [Install]
  WantedBy=default.target
Environment (fill these in with your keys):

  [Service]
  Environment="B2_ACCOUNT_ID="
  Environment="B2_ACCOUNT_KEY="
  Environment="RESTIC_REPOSITORY="
  Environment="RESTIC_PASSWORD="
Timer:

  [Timer]
  OnCalendar=*-*-* 00:30:00
  RandomizedDelaySec=20min

  [Install]
  WantedBy=timers.target
Re:Backblaze B2 Cloud Storage Now Has S3 Compatible APIs by kwesthaus on Monday May 04, 2020 @12:46PM (#23070280)
I also use restic and I have a cron script which runs early Monday morning every week. Restic supports auto-pruning, so I have it set up to backup a new snapshot then purge all except the most recent 100 years, 12 months, and 5 weeks.
Re:Backblaze B2 Cloud Storage Now Has S3 Compatible APIs by Fritsdehacker on Monday May 04, 2020 @12:44PM (#23070256)
I've made systemd profiles and timers to do restic backups. It's really clean and works well. Also much better testable than cron. It will most likely also work for more complex scenarios, like you're mentioning.
Re:Backblaze B2 Cloud Storage Now Has S3 Compatible APIs by qmmmur on Monday May 04, 2020 @01:15PM (#23070668)
Any chance you could clue me in on the scripts? Or point me to some resources to learn systemd? I've really disliked cron since having to use it for some auto push CI/CD stuff.
Re:Backblaze B2 Cloud Storage Now Has S3 Compatible APIs by ac29 on Monday May 04, 2020 @01:34PM (#23070919)
I just set this up last week, and it works well:

https://fedoramagazine.org/automate-backups-with-restic-and-...

edit: one gotcha is that using "user" systemd units, they will only run when the user is logged in. So, for a personal device like a laptop, this is fine, but for a server, it might not do what you're thinking. For the server use case, you probably want to enable linger for that utility user, so that units will run even with no active logged in sessions:

# loginctl enable-linger username