Kodi Community Forum

Full Version: Prevent shutdown
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I'm actually looking for a workaround to prevent system shutdown when e.g. a PVR timer is running. Anyone got an idea?
I'm actually using Ubuntu 16.04 with Kodi 17.

In Ubuntu 14.04 LTS with Kodi 16 I managed this like this, which was working pretty good:

Code:
[[email protected]:~] {0}
cat /etc/cron.d/prevent-shutdown
*       *       *       *       *       root    /home/hts/prevent_shutdown.sh; sleep 15; /home/hts/prevent_shutdown.sh; sleep 15; /home/hts/prevent_shutdown.sh; sleep 15; /home/hts/prevent_shutdown.sh

[[email protected]:~] {0}
cat /home/hts/prevent_shutdown.sh
#!/bin/bash

/usr/lib/pm-utils/sleep.d/94-hts-prevent-shutdown.sh > /dev/null 2>&1
if [[ $? -ge 1 ]]; then
        chmod 0000 /sbin/shutdown
        chmod 000 /usr/sbin/pm-suspend
else
        [ -f /sbin/shutdown ] || ln -s /bin/systemctl /sbin/shutdown
        chmod 755 /sbin/shutdown
        chmod 775 /usr/sbin/pm-suspend
fi

Since the change from init.d to systemd, this solution is not working anymore.
I did already tried removing executable flags from /sbin/shutdown respectively /bin/systemctl, which was not working. Even removing the symlink is not working.
Therefore it looks like systemd uses another way.
systemd-inhibit won't be a solution, due tvheadend does not fork an extra process which I could separately start with this hook.

Thanks in advance.