2

This is the script:

#!/bin/bash
setterm --blank 1 --powerdown 2

This is the service:

[Unit]
Description=Blank screen after 1 min and turn it off after 2 min. Any keypress will turn it back on.
After=ssh.service

[Service]
Type=oneshot
Environment=TERM=linux
StandardOutput=tty
TTYPath=/dev/console
ExecStart=/home/USER/.boot-scripts/screen-off.sh

[Install]
WantedBy=local.target

if I enable it and start it, it work but when I reboot the server nothing happened. If I verified the status of the service this is what I get:


 ● screen-off.service - Blank screen after 1 min and turn it off after 2 min. Any keypress will turn it back on.
     Loaded: loaded (/etc/systemd/system/screen-off.service; enabled; vendor preset: enabled)
     Active: inactive (dead)

Any idea why it's not starting at boot and I have to do it manually?

Thanks

1

1 Answer 1

0

Thank to the help of – user535733 (which by mistake I delete the comment) local.target is not a normal systemd target on the boot path of an Ubuntu system. I move it to multi-user.target and now is working!

You must log in to answer this question.

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