On Tuesday 06 Aug 2013 15:18:39 Fons Adriaensen wrote:
Thanks to all who suggested solutions.
What difference should the '&& exit' make ? The ssh will terminate anyway when poweroff returns. Problem is that by then it's too late.
I think the fundamental problem is that you just can't expect 'systemctl poweroff' or whatever variation of it, to return and still have a clean system at that point.
So the explicit delay provided by the poweroff.timer unit seems the right solution. And I like it because it doesn't rely on anything undocumented - it just uses systemd's features.
Yeah, it's a nice, practical solution. The analytic part of me wonders if it's truly a "correct" solution: is there a genuine guarantee that the shell session will close and SSH will close the connection gracefully in 5 seconds? In practice, this should always happen, but it's probably still technically a race just like before. Just an academic exercise, though. Paul