Systemd/test/test-path/path-modified.service

8 lines
114 B
SYSTEMD
Raw Normal View History

[Unit]
Description=Service Test for Path units
[Service]
test-path: start infinite sleep instead of a short command The test sometimes fails, e.g. in bionic-s390x ci. I think it might be because the service binary exits before we get a chance to notice that it is running: 13:59:31 --- Listing only the last 100 lines from a long log. --- 13:59:31 line 293: path-mycustomunit.service: state = exited; result = success 13:59:31 line 293: path-unit.path: state = running; result = success (left: 4639845) 13:59:31 line 293: path-mycustomunit.service: state = exited; result = success 13:59:31 line 293: path-unit.path: state = running; result = success (left: 4539608) 13:59:31 line 293: path-mycustomunit.service: state = exited; result = success 13:59:31 line 293: path-unit.path: state = running; result = success (left: 4439376) 13:59:31 line 293: path-mycustomunit.service: state = exited; result = success 13:59:31 line 293: path-unit.path: state = running; result = success (left: 4338946) 13:59:31 line 293: path-mycustomunit.service: state = exited; result = success 13:59:31 line 293: path-unit.path: state = running; result = success (left: 4238702) 13:59:31 line 293: path-mycustomunit.service: state = exited; result = success 13:59:31 line 293: path-unit.path: state = running; result = success (left: 4138424) 13:59:31 line 293: path-mycustomunit.service: state = exited; result = success 13:59:31 line 293: path-unit.path: state = running; result = success (left: 4038116) 13:59:31 line 293: path-mycustomunit.service: state = exited; result = success 13:59:31 line 293: path-unit.path: state = running; result = success (left: 3937835) 13:59:31 line 293: path-mycustomunit.service: state = exited; result = success 13:59:31 line 293: path-unit.path: state = running; result = success (left: 3837553) 13:59:31 line 293: path-mycustomunit.service: state = exited; result = success 13:59:31 line 293: path-unit.path: state = running; result = success (left: 3737250) 13:59:31 line 293: path-mycustomunit.service: state = exited; result = success 13:59:31 line 293: path-unit.path: state = running; result = success (left: 3636934) 13:59:31 line 293: path-mycustomunit.service: state = exited; result = success 13:59:31 line 293: path-unit.path: state = running; result = success (left: 3536622) 13:59:31 line 293: path-mycustomunit.service: state = exited; result = success 13:59:31 line 293: path-unit.path: state = running; result = success (left: 3436318) 13:59:31 line 293: path-mycustomunit.service: state = exited; result = success 13:59:31 line 293: path-unit.path: state = running; result = success (left: 3336021) 13:59:31 line 293: path-mycustomunit.service: state = exited; result = success 13:59:31 line 293: path-unit.path: state = running; result = success (left: 3235730) 13:59:31 line 293: path-mycustomunit.service: state = exited; result = success 13:59:31 line 293: path-unit.path: state = running; result = success (left: 3135468) 13:59:31 line 293: path-mycustomunit.service: state = exited; result = success 13:59:31 line 293: path-unit.path: state = running; result = success (left: 3035158) 13:59:31 line 293: path-mycustomunit.service: state = exited; result = success 13:59:31 line 293: path-unit.path: state = running; result = success (left: 2934855) 13:59:31 line 293: path-mycustomunit.service: state = exited; result = success 13:59:31 line 293: path-unit.path: state = running; result = success (left: 2834541) 13:59:31 line 293: path-mycustomunit.service: state = exited; result = success 13:59:31 line 293: path-unit.path: state = running; result = success (left: 2732511) 13:59:31 line 293: path-mycustomunit.service: state = exited; result = success 13:59:31 line 293: path-unit.path: state = running; result = success (left: 2632255) 13:59:31 line 293: path-mycustomunit.service: state = exited; result = success 13:59:31 line 293: path-unit.path: state = running; result = success (left: 2532014) 13:59:31 line 293: path-mycustomunit.service: state = exited; result = success 13:59:31 line 293: path-unit.path: state = running; result = success (left: 2431746) 13:59:31 line 293: path-mycustomunit.service: state = exited; result = success 13:59:31 line 293: path-unit.path: state = running; result = success (left: 2331438) 13:59:31 line 293: path-mycustomunit.service: state = exited; result = success 13:59:31 line 293: path-unit.path: state = running; result = success (left: 2231213) 13:59:31 line 293: path-mycustomunit.service: state = exited; result = success 13:59:31 line 293: path-unit.path: state = running; result = success (left: 2130952) 13:59:31 line 293: path-mycustomunit.service: state = exited; result = success 13:59:31 line 293: path-unit.path: state = running; result = success (left: 2030663) 13:59:31 line 293: path-mycustomunit.service: state = exited; result = success 13:59:31 line 293: path-unit.path: state = running; result = success (left: 1930428) 13:59:31 line 293: path-mycustomunit.service: state = exited; result = success 13:59:31 line 293: path-unit.path: state = running; result = success (left: 1830172) 13:59:31 line 293: path-mycustomunit.service: state = exited; result = success 13:59:31 line 293: path-unit.path: state = running; result = success (left: 1729906) 13:59:31 line 293: path-mycustomunit.service: state = exited; result = success 13:59:31 line 293: path-unit.path: state = running; result = success (left: 1629652) 13:59:31 line 293: path-mycustomunit.service: state = exited; result = success 13:59:31 line 293: path-unit.path: state = running; result = success (left: 1529368) 13:59:31 line 293: path-mycustomunit.service: state = exited; result = success 13:59:31 line 293: path-unit.path: state = running; result = success (left: 1429110) 13:59:31 line 293: path-mycustomunit.service: state = exited; result = success 13:59:31 line 293: path-unit.path: state = running; result = success (left: 1328852) 13:59:31 line 293: path-mycustomunit.service: state = exited; result = success 13:59:31 line 293: path-unit.path: state = running; result = success (left: 1228593) 13:59:31 line 293: path-mycustomunit.service: state = exited; result = success 13:59:31 line 293: path-unit.path: state = running; result = success (left: 1128320) 13:59:31 line 293: path-mycustomunit.service: state = exited; result = success 13:59:31 line 293: path-unit.path: state = running; result = success (left: 1028083) 13:59:31 line 293: path-mycustomunit.service: state = exited; result = success 13:59:31 line 293: path-unit.path: state = running; result = success (left: 927824) 13:59:31 line 293: path-mycustomunit.service: state = exited; result = success 13:59:31 line 293: path-unit.path: state = running; result = success (left: 827564) 13:59:31 line 293: path-mycustomunit.service: state = exited; result = success 13:59:31 line 293: path-unit.path: state = running; result = success (left: 724935) 13:59:31 line 293: path-mycustomunit.service: state = exited; result = success 13:59:31 line 293: path-unit.path: state = running; result = success (left: 624664) 13:59:31 line 293: path-mycustomunit.service: state = exited; result = success 13:59:31 line 293: path-unit.path: state = running; result = success (left: 524411) 13:59:31 line 293: path-mycustomunit.service: state = exited; result = success 13:59:31 line 293: path-unit.path: state = running; result = success (left: 424124) 13:59:31 line 293: path-mycustomunit.service: state = exited; result = success 13:59:31 line 293: path-unit.path: state = running; result = success (left: 323853) 13:59:31 line 293: path-mycustomunit.service: state = exited; result = success 13:59:31 line 293: path-unit.path: state = running; result = success (left: 223585) 13:59:31 line 293: path-mycustomunit.service: state = exited; result = success 13:59:31 line 293: path-unit.path: state = running; result = success (left: 120356) 13:59:31 line 293: path-mycustomunit.service: state = exited; result = success 13:59:31 line 293: path-unit.path: state = running; result = success (left: 18053) 13:59:31 line 293: path-mycustomunit.service: state = exited; result = success 13:59:31 line 293: path-unit.path: state = running; result = success (left: -82385) 13:59:31 line 293: path-mycustomunit.service: state = exited; result = success 13:59:31 Test timeout when testing path-unit.path It seems test/test-path/path-service.service wasn't actually used for anything.
2020-09-27 15:33:20 +02:00
ExecStart=sleep infinity
Type=exec
core/path: recheck path specs when triggered unit changes state As documented in systemd.path(5): When a service unit triggered by a path unit terminates (regardless whether it exited successfully or failed), monitored paths are checked immediately again, and the service accordingly restarted instantly. This commit implements this behaviour for PathExists=, PathExistsGlob=, and DirectoryNotEmpty=. These predicates are essentially "level-triggered": the service should be activated whenever the predicate is true. PathChanged= and PathModified=, on the other hand, are "edge-triggered": the service should only be activated when the predicate *becomes* true. The behaviour has been broken since at least as far back as commit 8fca6944c2 ("path: stop watching path specs once we triggered the target unit"). This commit had systemd stop monitoring inotify whenever the triggered unit was activated. Unfortunately this meant it never updated the ->inotify_triggered flag, so it never rechecked the path specs when the triggered unit deactivated. With this commit, systemd rechecks all paths specs whenever the triggered unit deactivates. If any PathExists=, PathExistsGlob= or DirectoryNotEmpty= predicate passes, the triggered unit is reactivated. If the target unit is activated by something outside of the path unit, the path unit immediately transitions to a running state. This ensures the path unit stops monitoring inotify in this situation. With this change in place, commit d7cf8c24d4 ("core/path: fix spurious triggering of PathExists= on restart/reload") is no longer necessary. The path unit (and its triggered unit) is now always active whenever the PathExists= predicate passes, so there is no spurious restart when systemd is reloaded or restarted.
2020-05-05 05:50:04 +02:00
RemainAfterExit=true