Hier werden die Unterschiede zwischen zwei Versionen gezeigt.
— |
admin_grundlagen:systemd_path_unit_files [2022/04/22 14:05] (aktuell) ingo_wichmann angelegt |
||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
+ | ====== Path Activation Beispiel "Die ultimative Maschine" ====== | ||
+ | systemctl edit --full --force paac.service | ||
+ | |||
+ | <file txt /etc/systemd/system/paac.service> | ||
+ | [Unit] | ||
+ | Description=Path Activation Service | ||
+ | |||
+ | [Service] | ||
+ | Type=oneshot | ||
+ | ExecStart=sh -c 'for f in /tmp/paac/*; do echo "lösche $f: $(cat $f)"; rm "$f"; done' | ||
+ | </file> | ||
+ | |||
+ | systemctl edit --full --force paac.path | ||
+ | |||
+ | <file txt /etc/systemd/system/paac.path> | ||
+ | [Unit] | ||
+ | Description=Demonstrate Path Activation | ||
+ | |||
+ | [Path] | ||
+ | MakeDirectory=true | ||
+ | PathChanged=/tmp/paac | ||
+ | |||
+ | [Install] | ||
+ | WantedBy=default.target | ||
+ | |||
+ | </file> | ||
+ | |||
+ | systemctl start paac.path | ||
+ | |||
+ | ==== Ausprobieren ===== | ||
+ | echo test > /tmp/paac/file | ||
+ | journalctl -fu paac.service |