You are not logged in.

#1 2022-11-07 07:51:57

asklow
Member
Registered: 2022-11-07
Posts: 68

[SOLVED] How do I know that .logout is actually executing ?

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

#2 2022-11-07 08:30:28

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,442

Re: [SOLVED] How do I know that .logout is actually executing ?

"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.log

Offline

#3 2022-11-07 08:42:28

asklow
Member
Registered: 2022-11-07
Posts: 68

Re: [SOLVED] How do I know that .logout is actually executing ?

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

#4 2022-11-07 09:05:51

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,442

Re: [SOLVED] How do I know that .logout is actually executing ?

How to invoke logout shell script ?

From where?
~/.bash_logout is triggered

man bash wrote:

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

#5 2022-11-07 09:10:52

asklow
Member
Registered: 2022-11-07
Posts: 68

Re: [SOLVED] How do I know that .logout is actually executing ?

seth wrote:

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

#6 2022-11-07 09:27:36

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,442

Re: [SOLVED] How do I know that .logout is actually executing ?

More important is: how do you start i3?
startx? Some DM?

Offline

#7 2022-11-07 09:31:09

asklow
Member
Registered: 2022-11-07
Posts: 68

Re: [SOLVED] How do I know that .logout is actually executing ?

seth wrote:

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

#8 2022-11-07 09:38:25

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,442

Re: [SOLVED] How do I know that .logout is actually executing ?

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

#9 2022-11-07 09:39:42

asklow
Member
Registered: 2022-11-07
Posts: 68

Re: [SOLVED] How do I know that .logout is actually executing ?

c) sounds more promising than the rest. Will look into it.

Offline

#10 2022-11-07 09:45:56

asklow
Member
Registered: 2022-11-07
Posts: 68

Re: [SOLVED] How do I know that .logout is actually executing ?

Tqvm. There's logout.log in my $HOME now ✌

Offline

#11 2022-11-07 13:04:16

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,442

Re: [SOLVED] How do I know that .logout is actually executing ?

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

#12 2022-11-07 13:13:30

asklow
Member
Registered: 2022-11-07
Posts: 68

Re: [SOLVED] How do I know that .logout is actually executing ?

@seth Understood.
I believe there's a reason shells manage these logout sequences.

Offline

Board footer

Powered by FluxBB