Closed rohrbachger closed 1 week ago
Perhaps as a cronjob, the DISPLAY variable is not available.
You could make a script, create a service file and a timer file for that service.
[Unit] Description=Daily Task Service
[Service] Type=oneshot ExecStart=/path/to/your/script.sh
[Install] WantedBy=multi-user.target
Replace /path/to/your/script.sh with the path to your script or command.
[Unit] Description=Runs the Daily Task Service once a day
[Timer] OnCalendar=daily Persistent=true
[Install] WantedBy=timers.target
This timer activates the service once a day at midnight. The Persistent=true option ensures that the task will be executed once the system is up if it was down at the scheduled time.
systemctl enable example.timer
I did it already before like you wrote. The final trick was to export the DISPLAY var. It's working fine now.
As we have some thinstations running I would like to get the serial number and model from the screens, and write that to an inventory database. We have about 100 thinstations with dual screen. ( View Horizon)
With python pedid this is no big deal, doing it from terminal.
But I did not figured out to run in the scheduled task or service. Technical I did but with a test I figured out that xrandr did not create output if i is running as a crontab job. It has only to run once per day or restart. Any suggestions and ideas? In pedid the xrandr output is parsed.