I have as file sync script I want executed periodically every 1 min or so. Since I may need separate instances for different users I run it as a user instead of root. The issue I have is that it seems only executed when logged in. That is the timer is started and remains started but the script does not execute until the moment I enter user/pass in the terminal or am already logged in. Why does this happen? What is causing it and how to make it run in the background like any other systemd timer?
Systemd service:
[Unit]
Description=******
[Service]
Type=oneshot
ExecStart=/usr/bin/*****
[Install]
WantedBy=******.timer
Systemd timer:
[Unit]
Description=**********
[Timer]
OnStartupSec=1m
OnUnitActiveSec=1m
Unit=********
[Install]
WantedBy=timers.target
Timer start command:
systemctl --user start *******.timer
@
notation. All you need to do is name the unit with a@
(foo@.service
, for example), and use%i
/%I
inside the unit.%i
/%I
will be replaced with the part after the@
. – Olorin Oct 16 '18 at 01:53