ALT Linux Sisyphus discussions
 help / color / mirror / Atom feed
* [sisyphus] systemd: path-based activation
@ 2015-09-16  7:17 Eugene Prokopiev
  2015-09-16  7:29 ` Денис Смирнов
  0 siblings, 1 reply; 22+ messages in thread
From: Eugene Prokopiev @ 2015-09-16  7:17 UTC (permalink / raw)
  To: ALT Linux Sisyphus discussions

Здравствуйте!

В процессе отладки altlinux-openresolv.* понял, что у меня вообще не
работает path-based activation либо я делаю что-то не так:

Вот простейший пример. Создаем файлы:

# cat file.path
[Unit]
Description=My path
RequiresMountsFor=/root
Before=paths.target shutdown.target
[Path]
PathChanged=/root/file.0
[Install]
WantedBy=multi-user.target

# cat file.service
[Unit]
Description=My service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/sh -c 'cat /root/file.0 > /root/file.1'
[Install]
WantedBy=multi-user.target

Перечитываем, запускаем, смотрим состояние:

[root@enp system]# systemctl daemon-reload
[root@enp system]# systemctl start file.path
[root@enp system]# systemctl status file.path
● file.path - My path
   Loaded: loaded (/etc/systemd/system/file.path; disabled; vendor
preset: disabled)
   Active: active (waiting) since Ср 2015-09-16 09:51:47 MSK; 4s ago
сен 16 09:51:47 enp.donpac.ru systemd[1]: Started My path.
[root@enp system]# systemctl status file.service
● file.service - My service
   Loaded: loaded (/etc/systemd/system/file.service; disabled; vendor
preset: disabled)
   Active: inactive (dead)

Теперь пишем в один файл и ожидаем увидеть результаты во втором:

# echo one > /root/file.0
# systemctl status file.service
● file.service - My service
   Loaded: loaded (/etc/systemd/system/file.service; disabled; vendor
preset: disabled)
   Active: active (exited) since Ср 2015-09-16 09:52:18 MSK; 9s ago
  Process: 1426 ExecStart=/bin/sh -c cat /root/file.0 > /root/file.1
(code=exited, status=0/SUCCESS)
 Main PID: 1426 (code=exited, status=0/SUCCESS)
сен 16 09:52:18 enp.donpac.ru systemd[1]: Starting My service...
сен 16 09:52:18 enp.donpac.ru systemd[1]: Started My service.
сен 16 09:52:18 enp.donpac.ru systemd[1]: Started My service.
сен 16 09:52:25 enp.donpac.ru systemd[1]: Started My service.
# cat /root/file.1
# echo two > /root/file.0
# systemctl status file.service
● file.service - My service
   Loaded: loaded (/etc/systemd/system/file.service; disabled; vendor
preset: disabled)
   Active: active (exited) since Ср 2015-09-16 09:52:18 MSK; 1min 54s ago
  Process: 1426 ExecStart=/bin/sh -c cat /root/file.0 > /root/file.1
(code=exited, status=0/SUCCESS)
 Main PID: 1426 (code=exited, status=0/SUCCESS)
сен 16 09:52:18 enp.donpac.ru systemd[1]: Starting My service...
сен 16 09:52:18 enp.donpac.ru systemd[1]: Started My service.
сен 16 09:52:18 enp.donpac.ru systemd[1]: Started My service.
сен 16 09:52:25 enp.donpac.ru systemd[1]: Started My service.
сен 16 09:54:11 enp.donpac.ru systemd[1]: Started My service.
# cat /root/file.1
#

Вручную разумеется все прекрасно:

# cat /root/file.0 > /root/file.1
# cat /root/file.1
two
#

Может я что-то делаю не так?

-- 
WBR,
Eugene Prokopiev

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2015-12-31  8:51 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-16  7:17 [sisyphus] systemd: path-based activation Eugene Prokopiev
2015-09-16  7:29 ` Денис Смирнов
2015-09-16 11:01   ` Eugene Prokopiev
2015-09-16 14:00       ` Eugene Prokopiev
2015-09-22  5:15       ` Eugene Prokopiev
2015-11-19 12:33             ` Michael Shigorin
2015-11-20 12:15             ` Eugene Prokopiev
2015-11-20 15:26                 ` Eugene Prokopiev
2015-11-20 16:54                     ` Eugene Prokopiev
2015-12-01 10:52                       ` Eugene Prokopiev
2015-12-23  9:22                           ` Eugene Prokopiev
2015-12-31  8:51                             ` Afanasov Dmitry
2015-11-21 14:10                   ` Денис Смирнов
2015-11-21 15:44                     ` Anton Gorlov
2015-12-01 10:50               ` Eugene Prokopiev
2015-12-01 10:58                 ` Eugene Prokopiev
2015-12-01 12:54                     ` Eugene Prokopiev
2015-12-01 12:58                       ` Eugene Prokopiev
2015-12-01 13:25                           ` Eugene Prokopiev
2015-12-02 13:58                               ` Eugene Prokopiev
2015-12-02 17:54                                   ` Anton Gorlov
2015-12-01 12:20                 ` Денис Смирнов

ALT Linux Sisyphus discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/sisyphus/0 sisyphus/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 sisyphus sisyphus/ http://lore.altlinux.org/sisyphus \
		sisyphus@altlinux.ru sisyphus@altlinux.org sisyphus@lists.altlinux.org sisyphus@lists.altlinux.ru sisyphus@lists.altlinux.com sisyphus@linuxteam.iplabs.ru sisyphus@list.linux-os.ru
	public-inbox-index sisyphus

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.sisyphus


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git