Replace incron with python inotify script + watchdog for managing slideshow restarts during management of picture files, this is operating on a 3s timeout for the restart which seems to be a decent balance given how fast syncthing can move files at times

This commit is contained in:
KemoNine 2020-08-03 23:48:05 +00:00
parent 559eff9e20
commit cd955d170c
1 changed files with 19 additions and 8 deletions

View File

@ -208,14 +208,25 @@ EOF
systemctl daemon-reload
systemctl enable --now no-cursor-tty1
systemctl enable --now fim
apt install incron
cat > /etc/incron.d/fim-delete <<EOF
/tank/pictures IN_DELETE systemctl restart fim
git clone https://git.kemonine.info/kemonine/piframe.git /opt/piframe
cp /opt/piframe/inotify-pictures.py /usr/local/bin/
chmod a+x /usr/local/bin/inotify-pictures.py
cat > /etc/systemd/system/inotify-pictures.service <<EOF
[Unit]
Description=Watch for picture folder changes and restart slideshow
After=fim.service
[Service]
Type=simple
User=root
ExecStart=/usr/local/bin/inotify-pictures.py
TimeoutSec=15
Restart=always
[Install]
WantedBy=multi-user.target
EOF
cat > /etc/incron.d/fim-create <<EOF
/tank/pictures IN_CREATE systemctl restart fim
EOF
systemctl enable --now incron
systemctl restart incron
systemctl daemon-reload
systemctl enable --now inotify-pictures
```