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

View file

@ -208,14 +208,25 @@ EOF
systemctl daemon-reload systemctl daemon-reload
systemctl enable --now no-cursor-tty1 systemctl enable --now no-cursor-tty1
systemctl enable --now fim systemctl enable --now fim
apt install incron git clone https://git.kemonine.info/kemonine/piframe.git /opt/piframe
cat > /etc/incron.d/fim-delete <<EOF cp /opt/piframe/inotify-pictures.py /usr/local/bin/
/tank/pictures IN_DELETE systemctl restart fim 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 EOF
cat > /etc/incron.d/fim-create <<EOF systemctl daemon-reload
/tank/pictures IN_CREATE systemctl restart fim systemctl enable --now inotify-pictures
EOF
systemctl enable --now incron
systemctl restart incron
``` ```