summaryrefslogtreecommitdiff
path: root/push-btrfs.service
blob: 7d320809742a088997f4ce0ea922cedc3217f721 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[Unit]
Description = Btrfs Backup over SSH
ConditionUser = root
ConditionPathExistsGlob = /etc/btrfs-backup/remotes/*.json

[Service]
WorkingDirectory = /etc/btrfs-backup/remotes
ExecStart = bash -e -c 'shopt -s failglob; \
                        units=(*.json); \
                        units=($${units[@]/.json/.timer}); \
                        units=($${units[@]/#/%p@}); \
                        systemctl enable "$${units[@]}"; \
                        entr -pnd -- true <<< . || true; \
                        '

[Install]
WantedBy=default.target