Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5384

Raspberry Pi OS • Re: Something Like .bash_logout, But for Shutdown

$
0
0
Thank you bls

In my searches I actually stumbled a systemd solution like this,
but was wondering If a bash file, something like .bash_logout might exist,
but named .bash_shutdown for example..

I guess there isn't, and systemd is the only way..
Pretty sure there isn't a way for your bash session to trap the shutdown and run a script, so yes, systemd appears to be the only way. systemd services are pretty easy to set up...

One more thing: If you want your personal shutdown script to run even if you're not logged in, you'll need to enable 'linger' on your account:

Code:

loginctl enable-linger

Statistics: Posted by bls — Thu Aug 29, 2024 6:41 pm



Viewing all articles
Browse latest Browse all 5384

Trending Articles