scheduled job with systemd - Unable to initialize GTK+

Discuss new features and functions
Posts: 3
Joined: 12 Oct 2021

Hermann-

Hi,

I try to get a scheduled job running with systemd timer and freefilesync. I've currently stuck with the following error message in journalctl -xe.
Error: Unable to initialize GTK+, is DISPLAY set properly?
FFS does start just fine with
DISPLAY=:0 freefilesync
I did add the environment variable with
export DISPLAY=:0
as suggested in the following FFS forum post, but the error is still there.
viewtopic.php?t=7838&sid=cf4be8b7bfd994d57ac7083a669a6805

Do you have an idea what I did wrong? Maybe something with the environment variable?
Thanks.


-------------------------------------------------------------------------------------------------
PS: Below is the config for systemd timer on Linux Mint 22


# ⚠️ Both names for timer and service have to match
# Persistent=true will execute missed job after wake up from sleep mode
sudo nano /etc/systemd/system/ffs-job.timer
# /etc/systemd/system/ffs-job.timer
# ffs-job.timer is a sample name and can be adjusted
[Unit]
Description=ffs job

[Timer]
OnCalendar=daily
Persistent=true

[Install]
WantedBy=timers.target
sudo nano  /etc/systemd/system/ffs-job.service

# /etc/systemd/system/myjob.service
# adjust the ExecStart path
[Unit]
Description=ffs job

[Service]
ExecStart=FreeFileSync "ExecStart=/path/to/script.ffs_batch"
sudo systemctl daemon-reload
sudo systemctl enable --now ffs-job.timer
troubleshoot
journalctl -xe
journalctl -u ffs-job.timer
systemd-analyze verify /etc/systemd/system/ffs-job.timer
systemd-analyze verify /etc/systemd/system/ffs-job.service
# check if timer starts correctly
systemctl start ffs-job.timer