Hello,
I want to have a unit that monitors a path and commits automatically to
git whenever something changes. It usually works, like that:

# cat git-commit@.service
[Unit]
Description=Automatic commit for %f

[Service]
Type = oneshot
Nice = 10

# git returns 1 if there is nothing to commit
SuccessExitStatus=1

WorkingDirectory = %f
ExecStart = /usr/bin/git add --all .
ExecStart = /usr/bin/git commit -a -m "Automatic commit."


# cat git-commit@.path 
[Unit]
Description = Path monitor for %f

[Path]
PathChanged = %f

[Install]
WantedBy = multi-user.target

It basically works but has two issues:

1) The path unit does not seem to monitor the path recursively, therefore I 
don't get a commit when a file in a subdirectory changes

2)Sometimes the commit fails, like when an application pushes files to quickly 
into the directory:

Failed to start Automatic commit for /etc.
git-commit@etc.service: Start request repeated too quickly

or when files vanish before they are commited.

This is usally not a problem, and I just want to restart it (after a short 
delay) Setting Restart=on-failure on a Type=oneshort unit does not work 
git-commit@etc.service: 

Service has Restart= setting other than no, which isn't allowed for 
Type=oneshot services. Refusing.

Any idea how to address these two issues?

Thanks!
Florian

_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to