LINUX.ORG.RU

systemd path

 , ,


0

1
MyMonitor.service

[Unit]
Description= My monitor service

[Service]
Type=oneshot
ExecStart=/usr/bin/free
ExecStart=/usr/bin/lsblk
[Install]
WantedBy=multi-user.target
MyMonitor.path

[Unit]
Description=My monitor path

[Path]
PathExists=/tmp/monitor

[Install]
WantedBy=multi-user.target

создаю touch /tmp/monitor Запускаю systemctl start MyMonitor.path

в логах:

Jun 09 12:41:21 vm01 systemd[1]: Starting My monitor service...
Jun 09 12:41:21 vm01 free[1834]:                total        used        free      shared  buff/cache   available
Jun 09 12:41:21 vm01 free[1834]: Mem:         8147840      254736     7512600        4900      380504     7653752
Jun 09 12:41:21 vm01 free[1834]: Swap:         998396           0      998396
Jun 09 12:41:21 vm01 lsblk[1835]: NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
Jun 09 12:41:21 vm01 lsblk[1835]: sda      8:0    0 51.3G  0 disk
Jun 09 12:41:21 vm01 lsblk[1835]: ├─sda1   8:1    0 50.3G  0 part /
Jun 09 12:41:21 vm01 lsblk[1835]: ├─sda2   8:2    0    1K  0 part
Jun 09 12:41:21 vm01 lsblk[1835]: └─sda5   8:5    0  975M  0 part [SWAP]
Jun 09 12:41:21 vm01 lsblk[1835]: sr0     11:0    1 58.2M  0 rom
Jun 09 12:41:21 vm01 systemd[1]: MyMonitor.service: Succeeded.
Jun 09 12:41:21 vm01 systemd[1]: Finished My monitor service.
Jun 09 12:41:21 vm01 systemd[1]: Starting My monitor service...
Jun 09 12:41:21 vm01 free[1836]:                total        used        free      shared  buff/cache   available
Jun 09 12:41:21 vm01 free[1836]: Mem:         8147840      254312     7513024        4900      380504     7654176
Jun 09 12:41:21 vm01 free[1836]: Swap:         998396           0      998396
Jun 09 12:41:21 vm01 lsblk[1837]: NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
Jun 09 12:41:21 vm01 lsblk[1837]: sda      8:0    0 51.3G  0 disk
Jun 09 12:41:21 vm01 lsblk[1837]: ├─sda1   8:1    0 50.3G  0 part /
Jun 09 12:41:21 vm01 lsblk[1837]: ├─sda2   8:2    0    1K  0 part
Jun 09 12:41:21 vm01 lsblk[1837]: └─sda5   8:5    0  975M  0 part [SWAP]
Jun 09 12:41:21 vm01 lsblk[1837]: sr0     11:0    1 58.2M  0 rom
Jun 09 12:41:21 vm01 systemd[1]: MyMonitor.service: Succeeded.
Jun 09 12:41:21 vm01 systemd[1]: Finished My monitor service.
Jun 09 12:41:21 vm01 systemd[1]: Starting My monitor service...
Jun 09 12:41:21 vm01 free[1838]:                total        used        free      shared  buff/cache   available
Jun 09 12:41:21 vm01 free[1838]: Mem:         8147840      253452     7513884        4900      380504     7655036
Jun 09 12:41:21 vm01 free[1838]: Swap:         998396           0      998396
Jun 09 12:41:21 vm01 lsblk[1839]: NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
Jun 09 12:41:21 vm01 lsblk[1839]: sda      8:0    0 51.3G  0 disk
Jun 09 12:41:21 vm01 lsblk[1839]: ├─sda1   8:1    0 50.3G  0 part /
Jun 09 12:41:21 vm01 lsblk[1839]: ├─sda2   8:2    0    1K  0 part
Jun 09 12:41:21 vm01 lsblk[1839]: └─sda5   8:5    0  975M  0 part [SWAP]
Jun 09 12:41:21 vm01 lsblk[1839]: sr0     11:0    1 58.2M  0 rom
Jun 09 12:41:21 vm01 systemd[1]: MyMonitor.service: Succeeded.
Jun 09 12:41:21 vm01 systemd[1]: Finished My monitor service.
Jun 09 12:41:21 vm01 systemd[1]: Starting My monitor service...
Jun 09 12:41:21 vm01 free[1840]:                total        used        free      shared  buff/cache   available
Jun 09 12:41:21 vm01 free[1840]: Mem:         8147840      253632     7513704        4900      380504     7654856
Jun 09 12:41:21 vm01 free[1840]: Swap:         998396           0      998396
Jun 09 12:41:21 vm01 lsblk[1841]: NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
Jun 09 12:41:21 vm01 lsblk[1841]: sda      8:0    0 51.3G  0 disk
Jun 09 12:41:21 vm01 lsblk[1841]: ├─sda1   8:1    0 50.3G  0 part /
Jun 09 12:41:21 vm01 lsblk[1841]: ├─sda2   8:2    0    1K  0 part
Jun 09 12:41:21 vm01 lsblk[1841]: └─sda5   8:5    0  975M  0 part [SWAP]
Jun 09 12:41:21 vm01 lsblk[1841]: sr0     11:0    1 58.2M  0 rom
Jun 09 12:41:21 vm01 systemd[1]: MyMonitor.service: Succeeded.
Jun 09 12:41:21 vm01 systemd[1]: Finished My monitor service.
Jun 09 12:41:21 vm01 systemd[1]: Starting My monitor service...
Jun 09 12:41:21 vm01 free[1842]:                total        used        free      shared  buff/cache   available
Jun 09 12:41:21 vm01 free[1842]: Mem:         8147840      253820     7513516        4900      380504     7654668
Jun 09 12:41:21 vm01 free[1842]: Swap:         998396           0      998396
Jun 09 12:41:21 vm01 lsblk[1843]: NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
Jun 09 12:41:21 vm01 lsblk[1843]: sda      8:0    0 51.3G  0 disk
Jun 09 12:41:21 vm01 lsblk[1843]: ├─sda1   8:1    0 50.3G  0 part /
Jun 09 12:41:21 vm01 lsblk[1843]: ├─sda2   8:2    0    1K  0 part
Jun 09 12:41:21 vm01 lsblk[1843]: └─sda5   8:5    0  975M  0 part [SWAP]
Jun 09 12:41:21 vm01 lsblk[1843]: sr0     11:0    1 58.2M  0 rom
Jun 09 12:41:21 vm01 systemd[1]: MyMonitor.service: Succeeded.
Jun 09 12:41:21 vm01 systemd[1]: Finished My monitor service.
Jun 09 12:41:21 vm01 systemd[1]: MyMonitor.service: Start request repeated too quickly.
Jun 09 12:41:21 vm01 systemd[1]: MyMonitor.service: Failed with result 'start-limit-hit'.
Jun 09 12:41:21 vm01 systemd[1]: Failed to start My monitor service.

Почему он выполняется в цикле и потом уходит в ошибку? Почему он не исполняется один раз?


Мб ты уже наконец перестанешь спамить форум вопросами и почитаешь ман?

intelfx ★★★★★
()
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.