Merge branch 'master' of 2px.info:flyingscorpio/SetupCockpit into master
This commit is contained in:
commit
d99ec8eba9
3 changed files with 8 additions and 6 deletions
|
@ -1,10 +1,10 @@
|
||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
###
|
###
|
||||||
### borg_backup.sh
|
### borg_backup.sh
|
||||||
###
|
###
|
||||||
### Usage:
|
### Usage:
|
||||||
### "$0" [-f]
|
### borg_backup.sh [-f]
|
||||||
###
|
###
|
||||||
### Options:
|
### Options:
|
||||||
### -f Force an update, even if one was already made today.
|
### -f Force an update, even if one was already made today.
|
||||||
|
@ -16,7 +16,7 @@ print_help() {
|
||||||
awk -F'### ' '/^###/ { print $2 }' "$0"
|
awk -F'### ' '/^###/ { print $2 }' "$0"
|
||||||
}
|
}
|
||||||
|
|
||||||
cache_file='/home/flyingscorpio/.cache/borg_backup_hook_last_executed'
|
cache_file="$HOME/.cache/borg_backup_hook_last_executed"
|
||||||
stat_cache_file() {
|
stat_cache_file() {
|
||||||
# We only want this file to be executed at most once per day, so we stat a cache
|
# We only want this file to be executed at most once per day, so we stat a cache
|
||||||
# file before running the rest of the code
|
# file before running the rest of the code
|
||||||
|
@ -44,7 +44,8 @@ touch "$cache_file"
|
||||||
BORG_REPO=ssh://flyingscorpio@2px.info:22/~/"$(hostname)".borg
|
BORG_REPO=ssh://flyingscorpio@2px.info:22/~/"$(hostname)".borg
|
||||||
export BORG_REPO
|
export BORG_REPO
|
||||||
|
|
||||||
export BORG_PASSPHRASE='ribosome66'
|
BORG_PASSPHRASE="$BORG_PASSPHRASE"
|
||||||
|
export BORG_PASSPHRASE
|
||||||
|
|
||||||
# some helpers and error handling:
|
# some helpers and error handling:
|
||||||
info() { printf "\n%s %s\n\n" "$(date)" "$*" >&2; }
|
info() { printf "\n%s %s\n\n" "$(date)" "$*" >&2; }
|
||||||
|
|
|
@ -6,7 +6,7 @@ Type = Package
|
||||||
Target = *
|
Target = *
|
||||||
|
|
||||||
[Action]
|
[Action]
|
||||||
Description = Update to lime2
|
Description = Borg backup
|
||||||
When = PreTransaction
|
When = PreTransaction
|
||||||
Exec = /bin/sh /home/flyingscorpio/SetupCockpit/borg_backup.sh
|
Exec = source /home/flyingscorpio/SetupCockpit/secrets && /home/flyingscorpio/SetupCockpit/borg_backup.sh
|
||||||
Depends = borg
|
Depends = borg
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
# secrets - is sourced by some commands - this is a template
|
# secrets - is sourced by some commands - this is a template
|
||||||
|
|
||||||
SETUP_COCKPIT_EMAIL=''
|
SETUP_COCKPIT_EMAIL=''
|
||||||
|
BORG_PASSPHRASE=''
|
||||||
|
|
Loading…
Add table
Reference in a new issue