GithubHelp home page GithubHelp logo

ryran / reboot-guard Goto Github PK

View Code? Open in Web Editor NEW
48.0 48.0 5.0 35 KB

Block systemd-initiated poweroff/reboot/halt until configurable condition checks pass

License: GNU General Public License v3.0

Python 100.00%

reboot-guard's People

Contributors

ryran avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

reboot-guard's Issues

RFE: make work on python2.7 and 3

On minimal modern fedora installations, it's common to have no python2 and it sucks to have to install that just for reboot-guard. It would be good to make it so that reboot-guard works with either 2.7 or 3.6+

How to continue shutdown process?

We are trying to use this for graceful shutdown purpose, the details I wrote in systemd mailing list.

There the problem is once ACPI signal comes, shutdown process will be blocked by this service.
How to continue shutdown process once ./rguard -1 --run sleep 30 was finished?
Because shutdown will not retry automatically.

Thanks!

feedback-stories tvheadend

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.

Is there a way to log or display a custom message when reboot is blocked ?

To help the operator get used to reboot-guard and to prevent negative perception, it would be quite useful to be able to display a custom message like:

[root]# systemctl reboot
Failed to issue method call: Operation refused, unit reboot.target may be requested by dependency only. This service is blocked by reboot-guard ...etc..etc...etc.

./rguard -0 does not work

it does not handle (rm_dir) /run/systemd/system/{halt,shutdown,poweroff}.target.d/{}.conf files

tested in archlinux with systemd 233-3

rguard -1 -d debug output:
DEBUG: Adding RefuseManualStart=yes to /run/systemd/system/poweroff.target.d/reboot-guard.conf
WARNING: ☹  Blocked poweroff.target
DEBUG: Adding RefuseManualStart=yes to /run/systemd/system/reboot.target.d/reboot-guard.conf
WARNING: ☹  Blocked reboot.target
DEBUG: Adding RefuseManualStart=yes to /run/systemd/system/halt.target.d/reboot-guard.conf
WARNING: ☹  Blocked halt.target
DEBUG: Reloading systemd via: systemctl daemon-reload
INFO: Exiting due to -1 or -0 option

rguard -0 -d debug output:

DEBUG: Unit poweroff.target already configured with RefuseManualStart=no
DEBUG: Unit reboot.target already configured with RefuseManualStart=no
DEBUG: Unit halt.target already configured with RefuseManualStart=no

Explicitly specify python2 on shebang line

A requirement of the rguard design was that it would work on RHEL7 out of the box, so python3 was unfortunately out of the question. For other operating systems where python2 is not the default python, rguard will fail. We should be explicitly specifying this in the shebang.

Session dies when shutdown is blocked

Maybe it's something strange with how my machine is configured, but when I turn on reboot-guard and run systemctl reboot (or sudo systemctl reboot) my KDE session dies, although the machine restart is blocked.

My use case is on stack exchange https://unix.stackexchange.com/questions/282237/how-can-i-prevent-systemctl-reboot-or-systemctl-poweroff-from-executing and this was suggested as the answer. I would really like for this to work, so I can accept that answer after 18 months :-)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.