Systemd shutdown, halt and reboot handling
-
That's rather something you should do at the system level i.e. dump a picture in your frame buffer after your application has closed.
-
I understood that. However as already written, that's not for your application to do because it's going to be stopped before the shutdown and reboot are going to happen. So if you trigger that from within your application then you can already show something but you still have to setup your system to show more information once your application is stopped because the frame buffer is likely going to be cleared at that point.
If you don't handle the shutdown through your application then how is it happening ?
-
Then as I already suggested, dump a picture in your frame buffer as part of the procedure. Your application will be killed quickly so it won't have the time to show anything special in that case.
-
In addition to what @SGaist wrote, there are limitations of what you can and can't do in signal handlers. Not everything is allowed.
-
@kshegunov it is done not from signal handler, but from slot, connected to qsocketnotifier.
-
Depending on what you do, you will get a
SIGTERM
and aSIGKILL
right after. The later you can't interrupt nor try to do some more stuff. -
60 second per running process ?
-
Can you find that information again ?
-
@SGaist No. Maybe i am mistaken. I found some info here: http://manpages.ubuntu.com/manpages/cosmic/en/man5/systemd.service.5.html
Check section about
TimeoutStopSec=
. On my system it is commented out, but here stated, that it is even 90 s. As i understand it is applied per-unit. -
Is your application started as a systemd service ?
-
@SGaist Yes, it is started as systemd service. Finally i found the reason, why it hangs. It is happened because I made blocking syscall from event loop. So this thread can be closed and marked as resolved. Appproach with QSocketNotifier and signalfd works.