Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feedback-stories tvheadend #7

Open
prietus opened this issue Apr 26, 2017 · 2 comments
Open

feedback-stories tvheadend #7

prietus opened this issue Apr 26, 2017 · 2 comments

Comments

@prietus
Copy link

prietus commented Apr 26, 2017

I used to have tvheadend running in a odroid c1. lately I needed to do transcoding and the odroid c1 is too weak so I set it up in a proper machine. I do care about power consumption so I needed to figure out a way of having the machine hibernated while not watching the iptv but also being sure it wouldnt hibernate while streaming video. reboot-guard is what I needed since I did not want to deal with systemd inhibitor locks and dbus. I do have a background service that queries the tvheadend api. if there is a subscription or a recording going on it saves the info to a file that I'm monitoring with inotify watch. depending on the contents I tell reboot-guard to avoid hibernate or not.
cheers.

@ryran
Copy link
Owner

ryran commented Apr 26, 2017

@prietus
Innnnnteresting! Thanks for sharing! By default, rguard only blocks poweroff, reboot, and halt targets ... did you have to uncomment hibernate.target to get this to work for you? E.g.:

def reboot_guard_systemd_refusemanualstart(self, enforce=True, targets=[]):
    """Block/unblock entering targets by way of RefuseManualStart=yes/no."""
    if not targets:
        targets = [
        'poweroff',
        'reboot',
        'halt',
        # 'hibernate',
        # 'hybrid-sleep',
        # 'suspend',
        ]
    reloadDaemon = False
    for t in targets:
        t += '.target'
        if enforce:
            if self.add_systemd_unit_start_block(t):
                reloadDaemon = True
        else:
            if self.del_systemd_unit_start_block(t):
                reloadDaemon = True
    if reloadDaemon:
        logging.debug("Reloading systemd via: systemctl daemon-reload")
        if not ret(subprocess.call(['systemctl', 'daemon-reload'])):
            logging.error("Unexpected error reloading systemd")

@prietus
Copy link
Author

prietus commented Apr 27, 2017

yeah I got hibernate working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants