To have a systemd service not start automatically at system boot time, but instead to run at a specific time.
Create a systemd service (/etc/systemd/system/iris.service) for the Iris eye protection software.
[Unit] Description=Iris Eye Protection Software After=lightdm.service [Service] Type=oneshot Environment=DISPLAY=:0 User=your_username ExecStart=/bin/bash -c 'DISPLAY=:0 xhost 127.0.0.1 && /opt/iris/Iris.sh' KillSignal=SIGINT Restart=on-failure RestartSec=2 [Install] WantedBy=multi-user.target
sudo systemctl enable iris.service
Create a systemd timer.
sudo vi /etc/systemd/system/iris.timer
…add the following lines in this file:
[Unit] Description=Iris Night Mode Timer Requires=iris.service [Timer] Unit=iris.service OnCalendar=*-*-* 18:00:00 [Install] WantedBy=timers.target
NOTE: This systemd timer will start the iris.service at 18:00:00 every day.
sudo systemctl enable iris.timer
sudo systemctl status iris.timer
returns:
● iris.timer - Iris Night Mode Timer Loaded: loaded (/etc/systemd/system/iris.timer; enabled; vendor preset: enabled) Active: active (waiting) since Sat 2023-06-03 17:32:12 +00; 24min ago Trigger: Sat 2023-06-03 18:00:00 +00; 22h left Triggers: ● iris.service