You are not logged in.
I could also use ~/.bash_logout, but I choose to run shell's ~/.logout.
How could I test whether the code inside it works ? Does arch even source ~/.logout ?
Last edited by asklow (2022-11-07 13:15:36)
Offline
"arch" doesn't source anything, "~/.logout" isn't canonically a thing and do check whether any script gets invoked just make is log itself:
date +"Executed .logout on %x at %X" >> ~/logout.logOffline
Although I do use ~/.profile regularly as I think /etc/profile already sources it.
Also yup. No output on your date log test, which means .logout isn't a thing.
I've even tried ~/.bash_logout but that doesn't work too. How to invoke logout shell script ?
Last edited by asklow (2022-11-07 08:43:30)
Offline
How to invoke logout shell script ?
From where?
~/.bash_logout is triggered
When an interactive login shell exits, or a non-interactive login shell executes the exit builtin command, bash reads and executes commands from the file ~/.bash_logout, if it exists.
Not when you're logging out of <random desktop environment>
Offline
Not when you're logging out of <random desktop environment>
I do run i3, so I'm mildly experienced (although the question of this thread is a noob question).
i3 quits using
i3-msg exit & other power stuff I usually just use systemctl for everything.
Is there anything I should do to get through my .logout ?
Also, I have ~/.bash_logout as a symlink to my ~/.logout caz I do sometimes run regular bourne shell too.
Last edited by asklow (2022-11-07 09:22:01)
Offline
More important is: how do you start i3?
startx? Some DM?
Offline
More important is: how do you start i3?
startx? Some DM?
Oh yah. Forgot to mention that.
Just plain "exec startx" from ~/.profile, then .xinitrc invokes "exec i3".
And I don't use any display managers.
Last edited by asklow (2022-11-07 09:33:16)
Offline
a) Use a lingering user service, see eg. https://bbs.archlinux.org/viewtopic.php?id=265711
b) change the way you exit i3, running a script before actually logging out
c) don't "exec startx" but just run "startx; exit" which should™ trigger .bash_logout
d) don't "exec i3", but trail i3 w/ whatever you want to do after it terminates
Edit:
Just plain "exec startx" from ~/.profile
depending on what that means, that's not a good idea at all because ~/.profile can end up being invoked by multiple things (notably DMs, if you ever y use one) and also this should™ not be unconditional to not fire on later login shells, https://wiki.archlinux.org/title/Xinit# … X_at_login
Last edited by seth (2022-11-07 09:41:19)
Offline
c) sounds more promising than the rest. Will look into it.
Offline
Tqvm. There's logout.log in my $HOME now ✌
Offline
nb. the cited line from the bash manpage - the bash_logout script might fire too often and, depending on what you put there and why, at undesirable times.
In that case you could execute the .logout script or just the required commands directly before the "exit"
Other than that, please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.
Offline
@seth Understood.
I believe there's a reason shells manage these logout sequences.
Offline