Re: How to check for scheduled shutdown
Greg Wooledge wrote: > On Tue, Nov 22, 2022 at 06:22:57PM +0100, to...@tuxteam.de wrote: >> Hm. With SysV, you can't either (spoiler alert: the shutdown process >> itself is the one doing the timing by sleeping until fulfillment of >> its task). But you always can cancel it (shutdown -c with SysV, dunno, >> again, with systemd). > > The systemd shutdown(8) man page has a -c option for canceling a pending > shutdown. I have not tested this. it has always worked for me. songbird
Re: How to check for scheduled shutdown
Sven Joachim writes: > Perhaps that the --show option was only added in systemd 250 and is not > available in Bullseye and older Debian releases. Except as a backport, Bullseye backports has systemd 251.3.
Re: How to check for scheduled shutdown
Sven Joachim writes: [...] > > Perhaps that the --show option was only added in systemd 250 and is not > available in Bullseye and older Debian releases. > > Cheers, >Sven Ach, indeed. Sorry. KJ -- http://wolnelektury.pl/wesprzyj/teraz/
Re: How to check for scheduled shutdown
Kamil Joñca writes: > kjonca@alfa:~%man shutdown > SHUTDOWN(8) > > shutdown > > SHUTDOWN(8) > > NAME >shutdown - Halt, power off or reboot the machine > [...] > OPTIONS > [...] >--show >Show a pending shutdown action and time if there is any. > > kjonca@alfa:~%sudo shutdown --show > No scheduled shutdown. > > Am I overlooked something? On my machine, the man page doesn't mention --show. $ cat /etc/debian_version 11.5 $ man shutdown | tail -n1 systemd 247SHUTDOWN(8) $ /sbin/shutdown --show /sbin/shutdown: unrecognized option '--show' urs
Re: How to check for scheduled shutdown
On Tue, Nov 22, 2022 at 10:11:15PM +0100, Ximo wrote: > El 22/11/2022 a las 13:23, Urs Thuermann escribió: > > After shutdown -h I see no way to see this scheduled shutdown. > > Before systemd, I could always see the shutdown process with its > > arguments using ps(1). > > > > # date --date @$(head -1 /run/systemd/shutdown/scheduled |cut -c6-15) That looks quite fragile. If the output format changes even slightly, it'll start to give wrong answers. In order to offer a better solution, I'd need to *see* one of these files. Which in turn apparently means I need to generate one. So I guess I get to test that "cancel" option after all. unicorn:~$ sudo shutdown -r 23:59 [sudo] password for greg: Reboot scheduled for Tue 2022-11-22 23:59:00 EST, use 'shutdown -c' to cancel. unicorn:~$ cat /run/systemd/shutdown/scheduled USEC=166917954000 WARN_WALL=1 MODE=reboot OK. I can work with that. unicorn:~$ date -d @"$(awk -F= '/^USEC=/ {print $2/100}' /run/systemd/shutdown/scheduled)" Tue Nov 22 23:59:00 EST 2022 unicorn:~$ sudo shutdown -c unicorn:~$ cat /run/systemd/shutdown/scheduled cat: /run/systemd/shutdown/scheduled: No such file or directory Ironically, the "sudo shutdown -c" command blasted a message onto every terminal EXCEPT the one where I ran the command. Rather annoying. A solution built around "dotting in" the file in a shell would also work, but that's quite a bit more dangerous if the output format changes, or if I'm only seeing a "best case scenario" here. Before going there, I would want to check the systemd source code to see whether this file is written in a way that's guaranteed to be safe for a shell to dot in. That's more effort than I care to put into this right now.
Re: How to check for scheduled shutdown
On Tue, 22 Nov 2022 21:11:55 +0100 Sven Joachim wrote: > > kjonca@alfa:~%sudo shutdown --show > > No scheduled shutdown. > > > > Am I overlooked something? > > Perhaps that the --show option was only added in systemd 250 and is > not available in Bullseye and older Debian releases. I certainly don't see it on Bullseye. root@ideapc:~# cat /etc/debian_version 11.5 root@ideapc:~# shutdown --show shutdown: unrecognized option '--show' root@ideapc:~# -- Does anybody read signatures any more? https://charlescurley.com https://charlescurley.com/blog/
Re: How to check for scheduled shutdown
El 22/11/2022 a las 13:23, Urs Thuermann escribió: After shutdown -h I see no way to see this scheduled shutdown. Before systemd, I could always see the shutdown process with its arguments using ps(1). # date --date @$(head -1 /run/systemd/shutdown/scheduled |cut -c6-15)
Re: How to check for scheduled shutdown
On 2022-11-22 20:18 +0100, Kamil Jońca wrote: > Urs Thuermann writes: > >> After shutdown -h I see no way to see this scheduled shutdown. >> Before systemd, I could always see the shutdown process with its >> arguments using ps(1). > > Hm. > kjonca@alfa:~%man shutdown > SHUTDOWN(8) > > shutdown > > SHUTDOWN(8) > > NAME >shutdown - Halt, power off or reboot the machine > [...] > OPTIONS > [...] >--show >Show a pending shutdown action and time if there is any. > > kjonca@alfa:~%sudo shutdown --show > No scheduled shutdown. > > Am I overlooked something? Perhaps that the --show option was only added in systemd 250 and is not available in Bullseye and older Debian releases. Cheers, Sven
Re: How to check for scheduled shutdown
On Tue, Nov 22, 2022 at 08:18:31PM +0100, Kamil Jońca wrote: > Urs Thuermann writes: > > > After shutdown -h I see no way to see this scheduled shutdown. > > Before systemd, I could always see the shutdown process with its > > arguments using ps(1). > > Hm. > kjonca@alfa:~%man shutdown > SHUTDOWN(8) > > shutdown > > SHUTDOWN(8) > > NAME >shutdown - Halt, power off or reboot the machine > [...] > OPTIONS > [...] >--show >Show a pending shutdown action and time if there is any. > > kjonca@alfa:~%sudo shutdown --show > No scheduled shutdown. > > Am I overlooked something? Ah, this one, again, from the systemd side... Although, on the SysV side one could try to limp along with something like sudo cat /proc/$(cat /var/run/shutdown.pid)/cmdline :-) (Now the explicit path of shutdown's PID might be in itself a Debianism) Cheers -- t signature.asc Description: PGP signature
Re: How to check for scheduled shutdown
Urs Thuermann writes: > After shutdown -h I see no way to see this scheduled shutdown. > Before systemd, I could always see the shutdown process with its > arguments using ps(1). Hm. kjonca@alfa:~%man shutdown SHUTDOWN(8) shutdown SHUTDOWN(8) NAME shutdown - Halt, power off or reboot the machine [...] OPTIONS [...] --show Show a pending shutdown action and time if there is any. kjonca@alfa:~%sudo shutdown --show No scheduled shutdown. Am I overlooked something? -- http://wolnelektury.pl/wesprzyj/teraz/
Re: How to check for scheduled shutdown
On Tue, Nov 22, 2022 at 12:29:49PM -0500, Greg Wooledge wrote: > On Tue, Nov 22, 2022 at 06:22:57PM +0100, to...@tuxteam.de wrote: > > Hm. With SysV, you can't either [change the time, but you can cancel] > The systemd shutdown(8) man page has a -c option for canceling a pending > shutdown. I have not tested this. Thanks :) Cheers -- t signature.asc Description: PGP signature
Re: How to check for scheduled shutdown
On Tue, Nov 22, 2022 at 06:22:57PM +0100, to...@tuxteam.de wrote: > Hm. With SysV, you can't either (spoiler alert: the shutdown process > itself is the one doing the timing by sleeping until fulfillment of > its task). But you always can cancel it (shutdown -c with SysV, dunno, > again, with systemd). The systemd shutdown(8) man page has a -c option for canceling a pending shutdown. I have not tested this.
Re: How to check for scheduled shutdown
On Tue, Nov 22, 2022 at 09:09:56AM -0600, David Wright wrote: > On Tue 22 Nov 2022 at 15:56:48 (+0100), to...@tuxteam.de wrote: > > On Tue, Nov 22, 2022 at 08:48:25AM -0600, David Wright wrote: > > > > [...] > > > > > There's a file, "scheduled", that's created in /run/systemd/shutdown, > > > which contains the time, noisiness and destiny of the shutdown. > > > I haven't tried editing, say, the noisiness, to see whether I can stop > > > the flow of Wall messages on all my xterms. > > > > *My* shutdown has a command line option (-Q) for the latter. Dunno about > > yours ;-) > > # shutdown -Q +15 > shutdown: invalid option -- 'Q' > # Ah, that Other Init System. Moving fast and breaking things ;-) > But I meant in arrears, hence the "say". I see. Hm. With SysV, you can't either (spoiler alert: the shutdown process itself is the one doing the timing by sleeping until fulfillment of its task). But you always can cancel it (shutdown -c with SysV, dunno, again, with systemd). > I still haven't tried editing, say, the MODE=poweroff to MODE=reboot, > in order to see whether the file is only written, or read at intervals > as well. I might have done if I hadn't already started my browser, and > other miscellaneous tasks. That would be a nice experiment, yes :-) Cheers -- t signature.asc Description: PGP signature
Re: How to check for scheduled shutdown
On Tue, 22 Nov 2022 09:09:56 -0600 David Wright wrote: > > > I haven't tried editing, say, the noisiness, to see whether I can > > > stop the flow of Wall messages on all my xterms. > > > > *My* shutdown has a command line option (-Q) for the latter. Dunno > > about yours ;-) > > # shutdown -Q +15 > shutdown: invalid option -- 'Q' > # According to the man page for shutdown, --no-wall should do that. --no-wall Do not send wall message before halt, power-off, reboot. -- Does anybody read signatures any more? https://charlescurley.com https://charlescurley.com/blog/
Re: How to check for scheduled shutdown
On Tue 22 Nov 2022 at 15:56:48 (+0100), to...@tuxteam.de wrote: > On Tue, Nov 22, 2022 at 08:48:25AM -0600, David Wright wrote: > > [...] > > > There's a file, "scheduled", that's created in /run/systemd/shutdown, > > which contains the time, noisiness and destiny of the shutdown. > > I haven't tried editing, say, the noisiness, to see whether I can stop > > the flow of Wall messages on all my xterms. > > *My* shutdown has a command line option (-Q) for the latter. Dunno about > yours ;-) # shutdown -Q +15 shutdown: invalid option -- 'Q' # But I meant in arrears, hence the "say". I still haven't tried editing, say, the MODE=poweroff to MODE=reboot, in order to see whether the file is only written, or read at intervals as well. I might have done if I hadn't already started my browser, and other miscellaneous tasks. Cheers, David.
Re: How to check for scheduled shutdown
On Tue, Nov 22, 2022 at 08:48:25AM -0600, David Wright wrote: [...] > There's a file, "scheduled", that's created in /run/systemd/shutdown, > which contains the time, noisiness and destiny of the shutdown. > I haven't tried editing, say, the noisiness, to see whether I can stop > the flow of Wall messages on all my xterms. *My* shutdown has a command line option (-Q) for the latter. Dunno about yours ;-) Cheers -- t signature.asc Description: PGP signature
Re: How to check for scheduled shutdown
On Tue 22 Nov 2022 at 13:23:14 (+0100), Urs Thuermann wrote: > After shutdown -h I see no way to see this scheduled shutdown. > Before systemd, I could always see the shutdown process with its > arguments using ps(1). > > Now, the call to shutdown returns to the shell immediately leaving no > process. It probably communicates to the init process 1, but, as > usual for systemd, very little or nothing seems to be documented. Or > at least it's hidden, so that you cannot find it in reasonable time. > > I couldn't find any relevant differences with and without a scheduled > shutdown in the output of systemctl status --all and systemctl show --all. There's a file, "scheduled", that's created in /run/systemd/shutdown, which contains the time, noisiness and destiny of the shutdown. I haven't tried editing, say, the noisiness, to see whether I can stop the flow of Wall messages on all my xterms. Cheers, David.