add systemd service
Fixes #2. add timer; make systemd unit instantiated add some information on systemd unit
This commit is contained in:
40
README.md
40
README.md
@@ -5,19 +5,45 @@
|
|||||||
This bash script sends incremental snapshots to another drive for backing up
|
This bash script sends incremental snapshots to another drive for backing up
|
||||||
data. Plug in and mount any btrfs-formatted device you want your system to be
|
data. Plug in and mount any btrfs-formatted device you want your system to be
|
||||||
backed up to (like a USB drive). When you run the script you will be prompted
|
backed up to (like a USB drive). When you run the script you will be prompted
|
||||||
to select a mounted btrfs device.
|
to select a mounted btrfs device, or you can optionally select the disk using
|
||||||
|
its UUID on the command line.
|
||||||
|
|
||||||
The script iterates through all snapper configurations. For each configuration
|
The script iterates through all snapper configurations by default (this can be
|
||||||
it creates a new local snapshot. If you have never synced to the specified
|
changed using the `-c` flag). For each configuration it creates a new local
|
||||||
device you will be prompted to enter a directory on the device where the backup
|
snapshot. If you have never synced to the specified device you will be prompted
|
||||||
snapshots will go. Additionally you are shown the location of the backed up
|
to enter a directory on the device where the backup snapshots will go.
|
||||||
snapshot. If you have performed a backup to this device before, only the changes
|
Additionally you are shown the location of the backed up snapshot. If you have
|
||||||
since the last backup have to be sent.
|
performed a backup to this device before, only the changes since the last backup
|
||||||
|
have to be sent.
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
snapper is required.
|
snapper is required.
|
||||||
|
|
||||||
|
|
||||||
|
## Options
|
||||||
|
|
||||||
|
Usage: snap-sync [options]
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-d, --description <desc> Change the snapper description. Default: "latest incremental backup"
|
||||||
|
-c, --config <config> Specify the snapper configuration to use. Otherwise will perform for each snapper
|
||||||
|
configuration. Can list multiple configurations within quotes, space-separated
|
||||||
|
(e.g. -c "root home").
|
||||||
|
-n, --noconfirm Do not ask for confirmation for each configuration. Will still prompt for backup
|
||||||
|
directory name on first backup
|
||||||
|
-u, --UUID <UUID> Specify the UUID of the mounted BTRFS subvolume to back up to. Otherwise will prompt.
|
||||||
|
If multiple mount points are found with the same UUID, will prompt user.
|
||||||
|
|
||||||
|
## Systemd unit and timer
|
||||||
|
|
||||||
|
A systemd unit and timer are included. These are instantiated units. You need to
|
||||||
|
specify the UUID of the disk to back up to in the `systemctl` call. Note, once
|
||||||
|
again, the disk **must** be mounted, and it **must** only be mounted in one
|
||||||
|
place. Example:
|
||||||
|
|
||||||
|
# systemctl start snap-sync@7360922b-c916-4d9f-a670-67fe0b91143c
|
||||||
|
|
||||||
## Example output
|
## Example output
|
||||||
|
|
||||||
# snap-sync
|
# snap-sync
|
||||||
|
|||||||
12
systemd/snap-sync@.service
Normal file
12
systemd/snap-sync@.service
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=snap-sync
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
|
||||||
|
ExecStart=/usr/bin/snap-sync \
|
||||||
|
--UUID %i \
|
||||||
|
--noconfirm
|
||||||
10
systemd/snap-sync@.timer
Normal file
10
systemd/snap-sync@.timer
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Run snap-sync weekly
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
OnCalendar=weekly
|
||||||
|
AccuracySec=12h
|
||||||
|
Persistent=true
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=timers.target
|
||||||
Reference in New Issue
Block a user