Raspberry PI tty1 monitor autostart

We wanted to show a logfile on a display connected to a Raspberry PI.

As described in https://raymii.org/s/tutorials/Run_software_on_tty1_console_instead_of_login_getty.html we created the file: /etc/systemd/system/getty@tty1.service.d/override.conf with this content:

[Service]
ExecStart=
ExecStart=-/home/pi/monitor.sh
StandardInput=tty
StandardOutput=tty

[Install]
WantedBy=multi-user.target

The script started by systemd gets the current file in /home/pi/logs and tails it:

#!/bin/bash
(
  cd /home/pi/logs
  sleep 10
  fn=$(ls -t1 | head -n1)
  tail -F ${fn}
)

To reload and enable the service:

systemctl daemon-reload
systemctl restart getty@tty1.service