Page 1 of 1

Request: integrated shutdown timer

Posted: Sun Jan 19, 2020 11:49 pm
by koymoy
Would like to have the option of installing an shutdown timer - the easy "dietpi-way" :)

Re: Request: integrated shutdown timer

Posted: Wed Feb 26, 2020 7:12 pm
by koymoy
Has this been seen or is it an absolute no-go?

Br.
Christian

Re: Request: integrated shutdown timer

Posted: Wed Feb 26, 2020 8:25 pm
by MichaIng
Actually the shutdown commands had a timer function: https://manpages.debian.org/buster/syst ... v/shutdown

But it requires dbus and logind to work:

Code: Select all

systemctl unmask systemd-logind
apt update
apt install libpam-systemd

Re: Request: integrated shutdown timer

Posted: Wed Feb 26, 2020 8:55 pm
by Joulinar
Hi,

I don`t think that this will be realised shortly.

Anyway it's not that complicated. First you would need to install dbus package

Code: Select all

apt-get install dbus
and unmask the the following service

Code: Select all

systemctl unmask systemd-logind.service
Scheduling a shutdown run the command:

Code: Select all

sudo shutdown -P 60
That will wait 60 mins before starting the shutdown sequence.

You could do as well

Code: Select all

sudo shutdown -P 1:00
to shutdown at 1 AM and

Code: Select all

sudo shutdown -P now
to shutdown now.

A message is broadcast to all terminals to warn about the shutdown.

Cancel a pending shutdown, if the time argument is not "+0" or "now", you can use:

Code: Select all

sudo shutdown -c 

Re: Request: integrated shutdown timer

Posted: Wed Feb 26, 2020 9:00 pm
by Joulinar
ahh shit I'm way to slow @MichaIng
But I used dbus and not libpam-systemd. Does that make any differences?

Re: Request: integrated shutdown timer

Posted: Wed Feb 26, 2020 9:12 pm
by MichaIng
libpam-systemd pulls dbus as dependency. I was not sure if dbus is sufficient or systemd-logind (libpam-systemd for full support) required. At least for non-root calls the later is required from what I found.