I'd like to reliably synchronize mail folders and profiles from the local disc to a server when the user shuts down its LMDE3/Cinnamon machine, like so:
Code: Select all
rsync -vahz --delete /home/<user>/eMail/ <user>@server:eMail/ rsync -vahz --delete /home/<user>/Profiles/ <user>@server:Profiles/
Since these are gigabytes the script will take several seconds, so the shutdown must wait for it to complete before closing the network or unmounting the disks.
Plus, for ssh, it needs to run as <user>, not as root.
Plus, Thunderbird and Firefox should have shut down correctly before sync'ing.
Currently I have these directories as Samba shares directly on the same server, but it is slow and gives some troubles with Thunderbird. Therefore I'd prefer to have them local and sync at the end of the day. I've tinkered with init.d scripts but without success so far.