خرید بک لینک

I am trying to do a backup of home directory from local SSD to local HDD on a desktop PC ruing Ubuntu 15.10. The idea is to perform a synchronization using rsyncrypto during the poweroff equence, because there are no file operations in home directory at that time, and I don't really care if the sync takes some time. So I created this systemd unit:

Code:

[Unit]
Description=backup to inteal HDD before shutdown
Before=umount.target poweroff.target
After=plymouth-poweroff.service
DefaultDependencies=no


[Service]
Type=oneshot
User=root
ExecStartPre=/bin/plymouth message "--text=Backuping SSD to HDD..."


ExecStart=/bin/bash /home/user/rsyncrypto.backup


ExecStop=/bin/plymouth message "--text=Finished backuping SSD to HDD"
KillMode=none


[Install]
WantedBy=poweroff.target
The rsyncrypto.backup script executed by the unit, builds several file lists (using the find) and runs several rsyncrypto instances in parallel using those file lists. Once enabled, the service gets started during the poweroff sequence, as expected, but no actual syncing gets done. The problem seems to be that during the creation of backup file lists, the target HDD gets unmounted. I have checked that the HDD is mounted when the script starts, but by the time file lists are created (which takes a couple of seconds), the HDD gets unmounted, and rsyncrypto just reports error that it can't find encryption keys which are on the HDD. After all rsyncrypto instances report errors and exit, I check all mounts, and HDD is not there any more, as well as some other mounts that were present when the script was started.

From what I understand, this should not happen. Unmounting of all local drives is triggered by umount.target which should be started after my service. The service type is 'oneshot', so all subsequent units should wait until it finishes.

What am I missing?

برچسب: نویسنده: استخدام کار تاريخ: دوشنبه 24 اسفند 1394 ساعت: 18:02

صفحه بندی