0

I'm wondering is there a way to prevent shutting down for specified time like for example 90 sec after boot-up? (from a remote that has shutdown now command)

I would like the solution to be in systemd style.

The true problem is that when someone boots the device all starting services kicks in and for example if that person would turn off device like 1-45 sec after start all services would be fine except this one sending projector power-off signal. Signal would be sent fine of course but it would have no effect due to projector heating state

So therefore I want to make a delay solution, I cannot check power status of projector.

So far I ended up with really basic sh script that starts after graphical.target. It is a solution (poor one).

In addition reboot is a problem to because I do not want to power-off projector while rebooting so I don't think ExecStop= will do the trick...

0

1 Answer 1

0

So your system somehow automatically turns on/off the projector. You should integrate your solution with this process. Maybe the system can not only turn the projector on/off but also determine its state? That would be best.

Systemd services can take up to 90 seconds to stop by default. So you have a lot of time.

If you can determine the projector’s power state, you should change the “power off” script to wait for the projector to truly turn off, in a loop.

If you cannot determine the projector’s power state, you can record the start time when you turn the projector on. In the “power off” script you would then just sleep until the desired time on top has passed before sending the actual “power off” signal.

If I misunderstood and the projector is somehow doing its own thing, you can still adapt the second proposal by just delaying the system shutdown process.

3
  • that's a good idea but... will it work with systemd? I can see that it would probably work with normal script. Problem is that in one projector I can ask power state but in other two I cannot so I want to get universal solution. As addition I don't know what's the problem but if I bind a script to a power button on remote it sometimes doesn't work so I set poweroff scripts to systemd so it always execute with normal shutdown Jun 21, 2021 at 7:33
  • Hm? This answer is specifically about Systemd. You create a service that is then stopped when shutting down. ExecStop=
    – Daniel B
    Jun 21, 2021 at 7:51
  • Oh okay. I'm trying it out right now. The way I see that and I'm trying to do is like create a target with service that ends in 30 sec after bootup and then I set all my shutdown services after that target... but I'm stuck with immediately shutdown with other services of course. Jun 21, 2021 at 8:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .