1

The file ~/.profile can be used to specify commands to run when a user logs in to a session. This has the advantage over ~/.bash_profile in that it works for shells other than bash and also works for at least some desktop environments (e.g. it works for me logging into Mate). However, I am wondering if there is an equivalent to ~/.profile for logging out, which (unlike ~/.bash_logout) will run commands on user logout for other shells as well as the Mate DE?

(note: I tried the obvious ~/.logout and it didn't seem to work)

To clarify, in response to some of the comments:

I am using OpenRC, not systemd, so the answer to this question doesn't help me. This is not in any way a duplicate of that question. I am looking for something that would be independent of the init system and also per user, not system-wide (hence the comparison to ~/.profile).

I think 'no' would be a perfectly acceptable answer, if the answer is 'no' (with perhaps an explanation of what is the 'proper' way to run commands on logout from the DE for a user).

Time4Tea
  • 2,366

0 Answers0