Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example of how to do automatic backups of logbook to GitHub #11

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions logbook-backup/backup-logs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
mkdir -p ~/log/_data/logbook
cd ~/log
git pull origin main
cp ~/.signalk/plugin-config-data/signalk-logbook/* ~/log/_data/logbook
if [ -z "$(git status --porcelain)" ]; then exit 0;fi
git add _data/logbook/*
git commit -m "Backup logbook entries"
git push origin main
10 changes: 10 additions & 0 deletions logbook-backup/logbook-backup.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Unit]
Description=Backup logbook to GitHub

[Service]
ExecStart=/home/pi/logbook-backup/backup-logs.sh
Type=oneshot
User=pi

[Install]
WantedBy=timers.target
10 changes: 10 additions & 0 deletions logbook-backup/logbook-backup.timer
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Unit]
Description=Back up logbook every hour

[Timer]
OnCalendar=hourly
Persistent=true
RandomizedDelaySec=3600

[Install]
WantedBy=timers.target