<p dir="ltr"><br>
Am 13.02.2014 00:14 schrieb "Kai Krakow" <<a href="mailto:hurikhan77@gmail.com">hurikhan77@gmail.com</a>>:<br>
><br>
> Mirco Tischler <<a href="mailto:mircotischler@gmx.net">mircotischler@gmx.net</a>> schrieb:<br>
><br>
> > It's late here so excuse me if I'm missing something. But wouldn't a<br>
> > simple Before=sleep.target suffice to implement b)?<br>
><br>
> I'm not sure... The unit is not enabled, only triggered by the timer - so it<br>
> may work. I think I may try that as an alternative to systemd-inhibit.<br>
> Systemd-inhibit just does not feel like the right tool for this.<br>
><br>
> > If your backup job is still running it blocks sleep.target's start until<br>
> > it finishes.<br>
><br>
> Then, what happens if I start using my system during backup, sleep.target<br>
> had been triggered but is waiting for the backup job to finish? Will it<br>
> simply go to sleep then while I am using the system? OTOH, will systemd-<br>
> inhibit cover that case?<br>
><br>
Yeah, the job to start sleep.target will still be active, so this should only work for overnight stuff.<br>
> Twisted around: What happens if sleep is triggered by the system due to idle<br>
> time while sleep is inhibited? Will it trigger as soon as the inhibit is<br>
> removed again? Or will the idle timer for my system just trigger sleep again<br>
> after it has passed a second time?<br>
><br>
Systemd-inhibit has the options block and delay for this. But when and if the idle time gets restarted is up to the idle timer ;-)<br>
> > Though for the grace period some ugly hack such as<br>
> > "ExecStartPost=/usr/bin/sleep <n>" would be required.<br>
><br>
> My primary concern here is btrfs doing a lot of background work when<br>
> handling snapshots. My backup medium is a btrfs with rsync copying the<br>
> source as in-place deltas to a scratch area, then taking a snapshot of it.<br>
> Later, I'd like to automatically cleanup old snapshots - but that means I<br>
> should wait before going back to sleep until btrfs finished that job. A<br>
> simple "sleep" probably won't do. I suppose it would require an option like<br>
> "--wait" to "btrfs subvolume delete", then wait another 5 minutes to give<br>
> all pending write commits a chance to make it to disk.<br>
Sounds like you want systemd-inhibit for both your backup service and the btrfs subvolume delete 'service'. And the kernel will call sync() before suspending, shouldn't that suffice?<br>
><br>
> --<br>
> Replies to list only preferred.</p>