LoginSignup
0
0

Systemdによるディレクトリ監視

Posted at

手順

ファイル作成

.pathと.serviceの前の文字列をそろえる。

cd /etc/systemd/system/
test.path
test.service

service編集

nano /etc/systemd/system/test.service

下記を追加

[Unit]
Description=DesktopSample

[Service]
WorkingDirectory=/home/takuya/Desktop
ExecStart=/bin/echo Hello From Service 

[Install]
WantedBy=default.target
~/.config/systemd/user/desktop.path
nano /etc/systemd/system/test.path

下記を追加

[Unit]
Description=DesktopSample

[Path]
## PathModified と PathChanged は別物
## 再帰的( recursively ) にパスの監視はできない。
## inotify をベースにしている
PathChanged=/home/takuya/Desktop
#PathModified=/home/takuya/Desktop
[Install]
WantedBy=default.target

ロードする

systemctl daemon-reload

systemctl enable desktop.service
systemctl enable desktop.path

systemctl restart desktop.service
systemctl restart desktop.path
参考サイト

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0