Merge branch 'notify'
This commit is contained in:
17
bin/snap-sync-wrapper
Executable file
17
bin/snap-sync-wrapper
Executable file
@@ -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
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user