[systemd-devel] Q systemd.path
Eric Lu
e4cu at yahoo.com
Sun Jun 14 12:53:00 PDT 2015
Thomasz,
Really appreciate your helps. It works perfectly now after taking your instructions.
--Regards,Eric Lu
On Sunday, June 14, 2015 2:39 AM, Tomasz Torcz <tomek at pipebreaker.pl> wrote:
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)
_______________________________________________
systemd-devel mailing list
systemd-devel at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20150614/8cda31dd/attachment.html>
More information about the systemd-devel
mailing list