diff --git a/bin/snap-sync-wrapper b/bin/snap-sync-wrapper new file mode 100755 index 0000000..8997697 --- /dev/null +++ b/bin/snap-sync-wrapper @@ -0,0 +1,17 @@ +#!/bin/bash + +# Notifies all users that a backup is running + +for u in $(users); do + + notify_cmd="sudo -u $u DISPLAY=:0 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(sudo -u $u id -u)/bus notify-send" + $notify_cmd 'Starting snap-sync backups to '$1'...' --icon=dialog-information + + /usr/bin/snap-sync --UUID $1 --noconfirm + if [[ $? == 0 ]]; then + $notify_cmd 'snap-sync backups to '$1' complete!' --icon=dialog-information + else + $notify_cmd 'Error in snap-sync backups. Check journal for more information.' --icon=dialog-error + fi + +done diff --git a/systemd/snap-sync@.service b/systemd/snap-sync@.service index 6ce82f5..3eee5a9 100644 --- a/systemd/snap-sync@.service +++ b/systemd/snap-sync@.service @@ -7,6 +7,4 @@ WantedBy=multi-user.target [Service] Type=simple -ExecStart=/usr/bin/snap-sync \ - --UUID %i \ - --noconfirm +ExecStart=/usr/bin/snap-sync-wrapper $i