I'm trying to switch from cron to systemd for a pretty simple thing. I have a small bash script sync_org_git which basically cd-s into a specific folder, does some git manipulations. The git commands write some things to stdout (untracked files, feedback after commit etc) which is nothing out of the ordinary for git, but systemctl --user start sync-org-git.timer says job failed. Do I need to modify my script or the systemd files?
Here's the service and timer file:
❯ cat sync-org-git.service
[Unit]
Description=sync org to git
[Service]
ExecStart=/home/fbence/bin/sync_org_git
❯ cat sync-org-git.timer
[Unit]
Description=Sync org git timer
Requires=sync-org-git.service
[Timer]
OnBootSec=0min
OnCalendar=*:*:0/5
Unit=sync_org_git.service
[Install]
WantedBy=multi-user.target
UPDATE
Using ExecStart=-/home/fbence/bin/sync_org_git
results in
sync-org-git.timer: Refusing to start, unit sync_org_git.service to trigger not loaded.
but I actually see the output of the shell script in the journal.
systemctl --user daemon-reloadafter editing the unit files?Unit=but the unit filename uses hyphens.Unit=line originally, as you don't need it anyway when the service has the same name (with .timer replaced by .service, of course).