How to run a daemon process only when xfce4 session is running?

Alex acs82 at gmx.de
Mon Jan 31 20:25:09 CET 2022


> But there's no logout 'hook' is there?  Where would I put this killall
so that it runs when I log out of the xfce4 session?

Maybe your version of xfce4-session is outdated ? I can hook stuff on
login, logout, hibernate, shutdown, .. and so on ... atached a screenshot.

Cheers, Alex


Am 31.01.22 um 18:09 schrieb Chris Green:
> Alexander Schwinn <acs82 at gmx.de> wrote:
>> [-- multipart/alternative, encoding 7bit, 82 lines --]
>>
>>      [-- text/plain, encoding quoted-printable, charset: utf-8, 43 lines --]
>>
>> Hi Chris,
>>
>> If you are using systemd, you could make a daemon out of it, and start
>> / stop it via systemctl start/stop. E.g:
>>
>> https://unix.stackexchange.com/questions/426862/proper-way-to-run-shell-script-as-a-daemon
>>
> Yes, I have some other things run by systemd but they run from startup
> to shutdown, not just during a GUI session.  Does systemd know about X
> sessions?
>
>
>> Though I did not check if that as well works without sudo magic / as a user.
>>
>> Another posibility could be to start it with nohup and and kill it via
>> "killall myscript" on logout
>>
> But there's no logout 'hook' is there?  Where would I put this killall
> so that it runs when I log out of the xfce4 session?
>
>
>> I suppose you saw the hooks to login/logout you can place in xfce4-session-settings
>> / applicatiom-autostart ?
>>
> Er, no, not really.  That's exactly the problem, I have my 'daemon' on
> xfce4-session-settings to start 'on login' but there doesn't seem to
> be any way to stop it at logout.
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Bildschirmfoto_2022-01-31_20-22-53.png
Type: image/png
Size: 72551 bytes
Desc: not available
URL: <https://mail.xfce.org/pipermail/xfce/attachments/20220131/61a31368/attachment-0001.png>


More information about the Xfce mailing list