diff --git a/roles/independent-auto-usb-backup/README.md b/roles/independent-auto-usb-backup/README.md index dddfce9f..aad4ae16 100644 --- a/roles/independent-auto-usb-backup/README.md +++ b/roles/independent-auto-usb-backup/README.md @@ -3,4 +3,5 @@ This tool role allows to make an automatic backup to an usb stick ## More information - https://unix.stackexchange.com/questions/67464/how-to-get-uuid-for-a-usb-drive -- https://unix.stackexchange.com/questions/65891/how-to-execute-a-shellscript-when-i-plug-in-a-usb-device \ No newline at end of file +- https://unix.stackexchange.com/questions/65891/how-to-execute-a-shellscript-when-i-plug-in-a-usb-device +- https://askubuntu.com/questions/25071/how-to-run-a-script-when-a-specific-flash-drive-is-mounted \ No newline at end of file diff --git a/roles/independent-auto-usb-backup/templates/usb-auto-backup.service.j2 b/roles/independent-auto-usb-backup/templates/usb-auto-backup.service.j2 new file mode 100644 index 00000000..f2d91958 --- /dev/null +++ b/roles/independent-auto-usb-backup/templates/usb-auto-backup.service.j2 @@ -0,0 +1,7 @@ +[Unit] +Description=delete old backups +OnFailure=systemd-email@%n.service + +[Service] +Type=oneshot +ExecStart=/usr/bin/python {{docker_backups_cleanup}}backups-cleanup.py --backups-folder-path {{backups_folder_path}} --maximum-backup-size-percent {{size_percent_maximum_backup}} diff --git a/roles/independent-auto-usb-backup/templates/usb-auto-backup.timer.j2 b/roles/independent-auto-usb-backup/templates/usb-auto-backup.timer.j2 new file mode 100644 index 00000000..141a511d --- /dev/null +++ b/roles/independent-auto-usb-backup/templates/usb-auto-backup.timer.j2 @@ -0,0 +1,10 @@ +[Unit] +Description=starts usb-auto-backup.service + +[Timer] +OnCalendar={{on_calendar_usb_auto_backup}} +RandomizedDelaySec={{randomized_delay_sec}} +Persistent=true + +[Install] +WantedBy=timers.target