[systemd-devel] Q systemd.path
Tomasz Torcz
tomek at pipebreaker.pl
Sun Jun 14 02:39:30 PDT 2015
On Sat, Jun 13, 2015 at 10:39:24PM -0700, Eric Lu wrote:
> Hi,
>
>
>
> I tested the functionality of system.path in a Fedora 21 workstation. The
> script was executed even though the file specified in PathExists=,
> /var/tmp/tst0, did not exist. Is there something I misunderstand or
:
>
Basically, you have enabled tst.service to be started during boot. So it
is started no matter if file exists or not. You have also enabled tst.path,
so tst.service should be started again when the file appear.
You should only enable .path unit. Additionaly, you can guard execution
of .service by ConditionPathExists= (or similar, check man systemd.unit).
>
> [root at f21 ylu]# systemctl status tst
>
> â tst.service - Tst Controller Service
> Loaded: loaded (/etc/systemd/system/tst.service; enabled)
^^^^^^^ it's enabled
> Active: inactive (dead) since Sat 2015-06-13 21:08:37 PDT; 1min 18s ago
> Process: 853 ExecStart=/usr/sbin/tst.sh (code=exited, status=0/SUCCESS)
> Main PID: 853 (code=exited, status=0/SUCCESS)
>
> [root at f21 ylu]# cat /etc/systemd/system/tst.path
>
> [Unit]
> Description=Activate test Service
> # DefaultDependencies=no
>
> [Path]
> PathExists=/var/tmp/tst0
>
> Unit=tst.service
>
> # [Install]
> # WantedBy=multi-user.target
No install instructions for tst.path.
>
> [root at f21 ylu]# cat /etc/systemd/system/tst.service
>
> [Unit]
> Description=Tst Controller Service
>
> [Service]
> Type=oneshot
> Environment=TERM=linux
> # NotifyAccess=all
> ExecStart=/usr/sbin/tst.sh
>
> [Install]
> Also=tst.path
> WantedBy=multi-user.target
tst.service install instruction.
--
Tomasz Torcz ,,If you try to upissue this patchset I shall be seeking
xmpp: zdzichubg at chrome.pl an IP-routable hand grenade.'' -- Andrew Morton (LKML)
More information about the systemd-devel
mailing list