[Unit] Description=Run e-Paper clean on shutdown and reboot DefaultDependencies=no Before=shutdown.target Before=reboot.target [Service] Type=oneshot ExecStartPre=/bin/bash -c "while pgrep -f '/usr/bin/python3 -u /root/2.13-Ink-screen-clock/bin/clean.py' > /dev/null; do sleep 1; done" ExecStart=/bin/bash /root/2.13-Ink-screen-clock/bin/clean.sh RemainAfterExit=yes TimeoutSec=0 [Install] WantedBy=shutdown.target WantedBy=reboot.target