Code Monkey home page Code Monkey logo

Comments (2)

ryran avatar ryran commented on August 16, 2024

@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")

from reboot-guard.

prietus avatar prietus commented on August 16, 2024

yeah I got hibernate working

from reboot-guard.

Related Issues (11)

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.