[systemd-devel] Monitor path to commit to git
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
[systemd-devel] java crashes only on boot
Hello, on my up to date Arch system I use Crashplan which is a java app for offsite backups. It used to work fine, until recently... When booting java dumps core: # systemctl status crashplan.service ● crashplan.service - CrashPlan Backup Service Loaded: loaded (/etc/systemd/system/crashplan.service; enabled; vendor preset: disabled) Active: failed (Result: signal) since So 2014-12-21 20:00:59 CET; 58s ago Process: 464 ExecStop=/opt/crashplan/bin/CrashPlanEngine stop (code=exited, status=0/SUCCESS) Process: 349 ExecStart=/opt/crashplan/bin/CrashPlanEngine start (code=exited, status=0/SUCCESS) Main PID: 366 (code=killed, signal=ABRT) Dez 21 20:00:48 horus CrashPlanEngine[349]: Starting CrashPlan Engine ... Using standard startup Dez 21 20:00:48 horus CrashPlanEngine[349]: OK Dez 21 20:00:48 horus systemd[1]: Started CrashPlan Backup Service. Dez 21 20:00:49 horus systemd[1]: crashplan.service: main process exited, code=killed, status=6/ABRT Dez 21 20:00:49 horus CrashPlanEngine[464]: Stopping CrashPlan Engine ... /opt/crashplan/bin/CrashPlanEngine: Zeile 144: kill: (366) - Kein passender Prozess gefunden Dez 21 20:00:50 horus systemd-coredump[459]: Process 366 (java) of user 0 dumped core. Dez 21 20:00:59 horus CrashPlanEngine[464]: OK Dez 21 20:00:59 horus systemd[1]: Unit crashplan.service entered failed state. Dez 21 20:00:59 horus systemd[1]: crashplan.service failed. % systemctl cat crashplan.service # /usr/lib/systemd/system/crashplan.service [Unit] Description=CrashPlan Backup Engine After=network.target [Service] Type=forking PIDFile=/opt/crashplan/CrashPlanEngine.pid EnvironmentFile=/opt/crashplan/bin/run.conf WorkingDirectory=/opt/crashplan ExecStart=/opt/crashplan/bin/CrashPlanEngine start ExecStop=/opt/crashplan/bin/CrashPlanEngine stop [Install] WantedBy=multi-user.target % systemctl --version systemd 218 +PAM -AUDIT -SELINUX -IMA -APPARMOR +SMACK -SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID -ELFUTILS +KMOD +IDN But when I start it manually with systemctl start crashplan.service it works fine. I got no idea where to look for clues... Thanks, Florian ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] java crashes only on boot
Andrei Borzenkov wrote: В Sun, 21 Dec 2014 21:24:22 +0100 Florian Lindner mailingli...@xgm.de пишет: Hello, on my up to date Arch system I use Crashplan which is a java app for offsite backups. It used to work fine, until recently... When booting java dumps core: # systemctl status crashplan.service ● crashplan.service - CrashPlan Backup Service Loaded: loaded (/etc/systemd/system/crashplan.service; enabled; vendor preset: disabled) Active: failed (Result: signal) since So 2014-12-21 20:00:59 CET; 58s ago Process: 464 ExecStop=/opt/crashplan/bin/CrashPlanEngine stop (code=exited, status=0/SUCCESS) Process: 349 ExecStart=/opt/crashplan/bin/CrashPlanEngine start (code=exited, status=0/SUCCESS) Main PID: 366 (code=killed, signal=ABRT) Dez 21 20:00:48 horus CrashPlanEngine[349]: Starting CrashPlan Engine ... Using standard startup Dez 21 20:00:48 horus CrashPlanEngine[349]: OK Dez 21 20:00:48 horus systemd[1]: Started CrashPlan Backup Service. Dez 21 20:00:49 horus systemd[1]: crashplan.service: main process exited, code=killed, status=6/ABRT Dez 21 20:00:49 horus CrashPlanEngine[464]: Stopping CrashPlan Engine ... /opt/crashplan/bin/CrashPlanEngine: Zeile 144: kill: (366) - Kein passender Prozess gefunden Dez 21 20:00:50 horus systemd-coredump[459]: Process 366 (java) of user 0 dumped core. Dez 21 20:00:59 horus CrashPlanEngine[464]: OK Dez 21 20:00:59 horus systemd[1]: Unit crashplan.service entered failed state. Dez 21 20:00:59 horus systemd[1]: crashplan.service failed. % systemctl cat crashplan.service # /usr/lib/systemd/system/crashplan.service [Unit] Description=CrashPlan Backup Engine After=network.target Does it depend on network? In this case network may not yet be available; you may try to use network-online.target instead. I don't think it depends on having actual network access. I tried using network-online.target but changed nothing. [Service] Type=forking PIDFile=/opt/crashplan/CrashPlanEngine.pid EnvironmentFile=/opt/crashplan/bin/run.conf WorkingDirectory=/opt/crashplan ExecStart=/opt/crashplan/bin/CrashPlanEngine start ExecStop=/opt/crashplan/bin/CrashPlanEngine stop [Install] WantedBy=multi-user.target % systemctl --version systemd 218 +PAM -AUDIT -SELINUX -IMA -APPARMOR +SMACK -SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID -ELFUTILS +KMOD +IDN But when I start it manually with systemctl start crashplan.service it works fine. I got no idea where to look for clues... Thanks, Florian ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] java crashes only on boot
Florian Lindner wrote: Hello, on my up to date Arch system I use Crashplan which is a java app for offsite backups. It used to work fine, until recently... When booting java dumps core: It certainly seems to some timing issue, adding ExecStartPre=/usr/bin/sleep 10 fixed it so far... :-/ ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] timesyncd: Frequent polling when no server could be reached
Another question I have is about the NTP status output of timedatectl. Right now (with ntpd running) it says: NTP enabled: yes NTP synchronized: no I suppose it need some more uptime than the 11 minutes I have currently? Possibly, ntpd needs to clear the STA_UNSYNC flag in adjtimex to mark the clock as synchronized. Kay, can you comment? If ntpd is running, timedatectl should not show enabled: yes, we only look for timesyncd. Please check that again, there seems something wrong in the setup. The synchronized flag comes straigt from the kernel like mentioned above, there is no other setting involved, seems like a ntpd problem. NTP synchronized is now yes, but ntp enabled also, though timesyncd is not running. Some console output: florian@horus ~ % timedatectl Local time: Di 2014-08-26 19:22:58 CEST Universal time: Di 2014-08-26 17:22:58 UTC RTC time: Di 2014-08-26 17:22:58 Time zone: Europe/Berlin (CEST, +0200) NTP enabled: yes NTP synchronized: yes RTC in local TZ: no DST active: yes Last DST change: DST began at So 2014-03-30 01:59:59 CET So 2014-03-30 03:00:00 CEST Next DST change: DST ends (the clock jumps one hour backwards) at So 2014-10-26 02:59:59 CEST So 2014-10-26 02:00:00 CET florian@horus ~ % systemctl status systemd-timesyncd.service ● systemd-timesyncd.service - Network Time Synchronization Loaded: loaded (/usr/lib/systemd/system/systemd-timesyncd.service; disabled) Active: inactive (dead) Docs: man:systemd-timesyncd.service(8) 3 florian@horus ~ % systemctl status ntpd.service :( ● ntpd.service - Network Time Service Loaded: loaded (/usr/lib/systemd/system/ntpd.service; enabled) Active: active (running) since Di 2014-08-26 19:09:20 CEST; 15min ago Process: 318 ExecStart=/usr/bin/ntpd -g -u ntp:ntp -p /run/ntpd.pid (code=exited, status=0/SUCCESS) Main PID: 329 (ntpd) CGroup: /system.slice/ntpd.service └─329 /usr/bin/ntpd -g -u ntp:ntp -p /run/ntpd.pid Aug 26 19:09:20 horus ntpd[329]: proto: precision = 0.093 usec (-23) Aug 26 19:09:20 horus ntpd[329]: Listen and drop on 0 v6wildcard [::]:123 Aug 26 19:09:20 horus ntpd[329]: Listen and drop on 1 v4wildcard 0.0.0.0:123 Aug 26 19:09:20 horus ntpd[329]: Listen normally on 2 lo 127.0.0.1:123 Aug 26 19:09:20 horus ntpd[329]: Listen normally on 3 lo [::1]:123 Aug 26 19:09:20 horus ntpd[329]: Listening on routing socket on fd #20 for interface updates Aug 26 19:09:20 horus systemd[1]: Started Network Time Service. Aug 26 19:09:25 horus ntpd[329]: Listen normally on 4 enp4s0 [fe80::224:1dff:fed7:99b%2]:123 Aug 26 19:09:25 horus ntpd[329]: new interface(s) found: waking up resolver Aug 26 19:09:31 horus ntpd[329]: Listen normally on 5 enp4s0 192.168.178.22:123 Aug 26 19:09:31 horus ntpd[329]: new interface(s) found: waking up resolver florian@horus ~ % ls /usr/lib/systemd/ntp-units.d 50-ntp.list 90-systemd.list florian@horus ~ % cat /usr/lib/systemd/ntp-units.d/50-ntp.list ntpd.service florian@horus ~ % cat /usr/lib/systemd/ntp-units.d/90-systemd.list systemd-timesyncd.service florian@horus ~ % systemctl --version systemd 215 +PAM -AUDIT -SELINUX -IMA -SYSVINIT +LIBCRYPTSETUP +GCRYPT +ACL +XZ +SECCOMP -APPARMOR ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] timesyncd: Frequent polling when no server could be reached
Hello, I tried out timesyncd today. Basically worked out of the box (disabled ntpd, enabling systemd-timesyncd and systemd-networkd, both unconfigured, side by side with NetworkManager). At my universities network they are blocking outgoing UDP why I can't reach any NTP timesyncd gives these message every 10 seconds: Aug 21 09:45:00 asaru systemd-timesyncd[317]: Timed out waiting for reply from 216.239.32.15:123 (time1.google.com). Aug 21 09:45:00 asaru systemd-timesyncd[317]: Using NTP server [2001:4860:4802:32::f]:123 (time1.google.com). Aug 21 09:45:00 asaru systemd-timesyncd[317]: Using NTP server 216.239.34.15:123 (time2.google.com). Aug 21 09:45:10 asaru systemd-timesyncd[317]: Timed out waiting for reply from 216.239.34.15:123 (time2.google.com). Aug 21 09:45:10 asaru systemd-timesyncd[317]: Using NTP server [2001:4860:4802:34::f]:123 (time2.google.com). Aug 21 09:45:10 asaru systemd-timesyncd[317]: Using NTP server 216.239.36.15:123 (time3.google.com). Polluting my log this way. Is is possible to inhibit that behavior? Maybe trying a couple of times, then giving up until next network status change. Another question I have is about the NTP status output of timedatectl. Right now (with ntpd running) it says: NTP enabled: yes NTP synchronized: no I suppose it need some more uptime than the 11 minutes I have currently? When I had timesyncd active it said NTP no, though I had a ntp client runnung, albeit definitly unsynchronized. Version is 215 Thanks, Florian ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Using path name in instantiated units
Andrei Borzenkov wrote: В Tue, 19 Aug 2014 22:08:26 +0200 Florian Lindner mailingli...@xgm.de пишет: Andrei Borzenkov wrote: В Tue, 19 Aug 2014 20:59:55 +0200 Florian Lindner mailingli...@xgm.de пишет: I also try to set up a matching timer: systemctl --user start git-commit@/home/florian/timer.test.timer works fine, but: systemctl --user enable git-commit@/home/florian/timer.test.timer Failed to execute operation: Invalid argument Or is creating a target for the timer and set WantedBy in the service file the way to go? But still, why is starting working, but not enabling? Does your unit have [Install] section? No. systemctl enable creates links listed in [Install] section; how do expect it to work in this case? The timer I try to enable contains a Install section. florian@asaru ~/.config/systemd/user % cat git-commit@.timer [Unit] Description=Timer to commit all changes in instance. [Timer] OnUnitActiveSec=5min OnActiveSec=5min AccuracySec = 5min [Install] WantedBy=default.target florian@asaru ~/.config/systemd/user % systemctl --user enable git- commit@/home/florian/timer.test.timer Failed to execute operation: Invalid argument Is my assumption that instance argument (the path) is derived from the timer to the unit wrong? This was my latter idea, creating a target and set WantedBy=that.target in the services [Install] section. Not? Yes (it may be any unit, not necessarily target). ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Using path name in instantiated units
Florian Lindner wrote: Andrei Borzenkov wrote: В Tue, 19 Aug 2014 22:08:26 +0200 Florian Lindner mailingli...@xgm.de пишет: Andrei Borzenkov wrote: В Tue, 19 Aug 2014 20:59:55 +0200 Florian Lindner mailingli...@xgm.de пишет: I also try to set up a matching timer: systemctl --user start git-commit@/home/florian/timer.test.timer works fine, but: systemctl --user enable git-commit@/home/florian/timer.test.timer Failed to execute operation: Invalid argument Or is creating a target for the timer and set WantedBy in the service file the way to go? But still, why is starting working, but not enabling? Does your unit have [Install] section? No. systemctl enable creates links listed in [Install] section; how do expect it to work in this case? The timer I try to enable contains a Install section. florian@asaru ~/.config/systemd/user % cat git-commit@.timer [Unit] Description=Timer to commit all changes in instance. [Timer] OnUnitActiveSec=5min OnActiveSec=5min AccuracySec = 5min [Install] WantedBy=default.target florian@asaru ~/.config/systemd/user % systemctl --user enable git- commit@/home/florian/timer.test.timer Failed to execute operation: Invalid argument Is my assumption that instance argument (the path) is derived from the timer to the unit wrong? I was expecting that the timer unit A@B.timer calls the service unit A@B.service. It seems to work fine with path units, as proposed by Anthony. Enabling a A@.timer works fine, but A@B.timer fails with the error message above. A Install section is present (btw, systemd gives a more verbose error message if a Install section is missing on enable). Curious, while systemctl --user enable git-commit@.timer gives no error message and zero return code, it does not place a link in default.target.wants... Sorry for my confusion...! ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Using path name in instantiated units
Anthony Messina wrote: On Wednesday, August 20, 2014 10:25:35 AM Florian Lindner wrote: [Timer] OnUnitActiveSec=5min OnActiveSec=5min AccuracySec = 5min I'm not sure it matters, but you have some extra spaces around = after AccuracySec. No, that shouldn't be the problem, I have changed it, it's still the same error and it works with whitespaces at some other units. Florian ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Using path name in instantiated units
Lennart Poettering wrote: On Wed, 20.08.14 10:25, Florian Lindner (mailingli...@xgm.de) wrote: The timer I try to enable contains a Install section. florian@asaru ~/.config/systemd/user % cat git-commit@.timer [Unit] Description=Timer to commit all changes in instance. [Timer] OnUnitActiveSec=5min OnActiveSec=5min AccuracySec = 5min [Install] WantedBy=default.target florian@asaru ~/.config/systemd/user % systemctl --user enable git- commit@/home/florian/timer.test.timer Failed to execute operation: Invalid argument Use something like this instead: systemctl --user enable `systemd-escape -p --template=git-commit@.timer /home/florian/timer.test` systemd-escape has not landed in my distribution yet (Arch). But with manual escaping to git-com...@home-florian-timer.test.timer and using %f it works. Thanks! ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] Using path name in instantiated units
Hello, I have a systemd unit that should do a commit on a specific path. Since there are more then one path / repos, I want to use an instantiated unit for that (the stuff with @ in the unit name): ~/.config/systemd/user % cat git-commit@.service [Unit] Description=Auto commit for instance. [Service] Type = oneshot Nice = 10 # git returns 1 if there is nothing to commit SuccessExitStatus=1 WorkingDirectory = %I # also tried %i ExecStart = /usr/bin/sh -c 'echo %i wd' ExecStart = /usr/bin/sh -c 'echo %i wd' ExecStart = /usr/bin/sh -c 'echo `pwd` wd' ExecStart = /usr/bin/git add --all . ExecStart = /usr/bin/git commit -a -m Automatic commit. It seems that using %i or %I to set the working directory does not work. When I do systemctl --user start git-commit@/home/florian/timer.test.service the journal prints: Aug 19 18:43:01 asaru systemd[375]: Starting Auto commit for instance Aug 19 18:43:01 asaru git[4761]: fatal: Not a git repository (or any of the parent directories): .git Aug 19 18:43:01 asaru systemd[375]: git-commit@-home-florian- timer.test.service: main process exited, code=exited, status=128/n/a Aug 19 18:43:01 asaru systemd[375]: Failed to start Auto commit for instance.. Aug 19 18:43:01 asaru systemd[375]: Unit git-commit@-home-florian- timer.test.service entered failed state. and wd (created in ~) contains -home-florian-timer.test -home-florian-timer.test /home/florian Any ideas how I can change the working directory to the directory given by the instance name? Thx! ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Using path name in instantiated units
Andrei Borzenkov wrote: В Tue, 19 Aug 2014 19:34:46 +0200 Florian Lindner mailingli...@xgm.de пишет: It seems that using %i or %I to set the working directory does not work. bor@opensuse:~ sudo systemctl start foo@/home/bor.service bor@opensuse:~ cat /tmp/foo /home/bor %i=-home-bor %I=/home/bor bor@opensuse:~ cat /run/systemd/system/foo@.service [Unit] Description=Path %i (%I) [Service] Type=oneshot WorkingDirectory=%I ExecStart=/bin/sh -c '/bin/pwd /tmp/foo; echo %%i=%i /tmp/foo; echo %%I=%I /tmp/foo' Ok, somehow I obviously got confused while testing. Sorry! I also try to set up a matching timer: systemctl --user start git-commit@/home/florian/timer.test.timer works fine, but: systemctl --user enable git-commit@/home/florian/timer.test.timer Failed to execute operation: Invalid argument Or is creating a target for the timer and set WantedBy in the service file the way to go? But still, why is starting working, but not enabling? Thx, Florian ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Using path name in instantiated units
Andrei Borzenkov wrote: В Tue, 19 Aug 2014 20:59:55 +0200 Florian Lindner mailingli...@xgm.de пишет: I also try to set up a matching timer: systemctl --user start git-commit@/home/florian/timer.test.timer works fine, but: systemctl --user enable git-commit@/home/florian/timer.test.timer Failed to execute operation: Invalid argument Or is creating a target for the timer and set WantedBy in the service file the way to go? But still, why is starting working, but not enabling? Does your unit have [Install] section? No. This was my latter idea, creating a target and set WantedBy=that.target in the services [Install] section. Not? ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] Identical mount resulting in different options
Hello! I am on an Arch Linux machine. Kernel is 3.9.3 x86_64, systemd 204. I have two identical hard drives. Both have a gparted created GPT table and a CLI created ext4 filesystem with no options other than -L (label). Archiv_1 was created like two weeks before Archiv_2 (which was created right now). I don't know about the exact kernel version or Archiv_1. Both are set in fstab with identical fstab options: LABEL=Archiv_1 /mnt/Archiv_1 ext4defaults LABEL=Archiv_2 /mnt/Archiv_2 ext4defaults yet they are actually mounted using a different option: /dev/sde1 on /mnt/Archiv_1 type ext4 (rw,relatime) /dev/sdd1 on /mnt/Archiv_2 type ext4 (rw,relatime,data=ordered) Default mount options from tune2fs are identical: root@horus /mnt/Archiv_2 # tune2fs -l /dev/sde1 | grep mount options Default mount options:user_xattr acl root@horus /mnt/Archiv_2 # tune2fs -l /dev/sdd1 | grep mount options Default mount options:user_xattr acl so is the mount file in run/systemd/generator/ But somehow systemd uses different options: root@horus ~ # systemctl show mnt-Archiv_1.mount A1 root@horus ~ # systemctl show mnt-Archiv_2.mount A2 root@horus ~ # diff -y A1 A2 [...] Where=/mnt/Archiv_1 | Where=/mnt/Archiv_2 What=/dev/sde1| What=/dev/sdd1 Options=rw,relatime,rw| Options=rw,relatime,rw,data=ordered [...] Why is that? Thanks! Florian ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel