Set display off after boot

Volumio Information

Volumio Version: 2.861
Hardware: x86
DAC: n/a

I would like to set my display off at all times regardless of lid open or closed or touch screen. I’ve tried the following.

/lib/systemd/system/screen_off.service

	[Unit]
	Description=screen off
	After=volumio.service

	[Service]
	Type=oneshot
	User=root
	Group=root
	ExecStart=/bin/bash /usr/bin/screen_off.sh

	[Install]
	WantedBy=multi-user.target

sudo chown root.root /lib/systemd/system/screen_off.service

/usr/bin/screen_off.sh

	#!/bin/bash
	xrandr -d :0 --output LVDS1 --off

chmod +x /usr/bin/screen_off.sh
sudo chown root.root /usr/bin/screen_off.sh

systemctl enable screen_off.service

My shell script works flawlessly from the CLI but not as a service.

Thanks

The following works. Display turns off after 2 minutes.

/lib/systemd/system/screen_off.service

	[Unit]
	Description=screen off

	[Service]
	Type=oneshot
	ExecStart=/usr/bin/screen_off.sh

/lib/systemd/system/screen_off.timer

	[Unit]
	Description=timer for screen_off

	[Timer]
	OnBootSec=2min

	[Install]
	WantedBy=timers.target

sudo chown root.root /lib/systemd/system/screen_off.service
sudo chown root.root /lib/systemd/system/screen_off.timer

/usr/bin/screen_off.sh (use xrandr -d :0 to determine display name)

	#!/bin/bash
	export XAUTHORITY=/home/volumio/.Xauthority
	xrandr -d :0 --output LVDS1 --off

sudo chmod +x /usr/bin/screen_off.sh
sudo chown root.root /usr/bin/screen_off.sh

systemctl daemon-reload
systemctl enable screen_off.timer

In case you wish to run it headless, you can also prevent the UI from starting by disabling the volumio-kiosk.service

i like the convenience of just turning the display back on. i am not sure if that’s possible when running headless? thank you for mentioning it though i really appreciate it.

to turn display back on:

xrandr -d :0 --output LVDS1 --off