Skip to content

Commit

Permalink
v1.0.0: implement #1 and #2 and update README
Browse files Browse the repository at this point in the history
  • Loading branch information
ryran committed Apr 8, 2017
1 parent 60f4a09 commit 65813a7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ Block systemd-initiated poweroff/reboot/halt until configurable condition checks
WARNING: ☹ Blocked poweroff.target
WARNING: ☹ Blocked reboot.target
WARNING: ☹ Blocked halt.target
WARNING: Exiting due to -1 or -0 option
[root]#
```
Expand All @@ -50,7 +49,6 @@ Block systemd-initiated poweroff/reboot/halt until configurable condition checks
WARNING: ☻ Unblocked poweroff.target
WARNING: ☻ Unblocked reboot.target
WARNING: ☻ Unblocked halt.target
WARNING: Exiting due to -1 or -0 option
[root]#
```
Expand Down Expand Up @@ -86,14 +84,15 @@ Block systemd-initiated poweroff/reboot/halt until configurable condition checks
```
### Instructions
### Instructions for daemon service
1. Install the rpm
- `yum install http://people.redhat.com/rsawhill/rpms/latest-rsawaroha-release.rpm`
- `yum install reboot-guard`
1. If you want the service to always block reboot/shutdown, requiring the service to be manually stopped or killed, simply run `systemctl daemon-reload; systemctl enable rguard --now` and you are done; otherwise, continue to next step
1. Play with the options until you get them how you want them (see help page: `rguard --help`)
1. Copy `/usr/lib/systemd/system/rguard.service` to `/etc/systemd/system` and modify set an `ExecStart=` directive
1. Run: `systemctl daemon-reload; systemctl enable rguard; systemctl start rguard`
1. Copy `/usr/lib/systemd/system/rguard.service` to `/etc/systemd/system` and set the `ExecStart=` directive to your liking
1. Run: `systemctl daemon-reload; systemctl enable rguard --now`
1. Check `systemctl status rguard -n50` or use `journalctl -fu rguard` to keep an eye on logs (turn up the `--loglevel` if necesary)
1. Tweak `rguard.service` as required, and then re-run `systemctl daemon-reload; systemctl restart rguard`
1. Give feedback by posting to the [Issue Tracker](https://github.com/ryran/reboot-guard/issues)
Expand Down
8 changes: 4 additions & 4 deletions rguard
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2015 Ryan Sawhill Aroha <rsaw@redhat.com>
# Copyright 2015, 2017 Ryan Sawhill Aroha <rsaw@redhat.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -26,8 +26,8 @@ from stat import S_IWRITE

prog = 'rguard'
vers = {}
vers['version'] = '0.2.2'
vers['date'] = '2015/09/02'
vers['version'] = '1.0.0'
vers['date'] = '2017/04/08'


def ret(returnCode):
Expand Down Expand Up @@ -454,7 +454,7 @@ def main():
r.guard(enforce=True)
else:
r.guard(enforce=False)
logging.warning("Exiting due to -1 or -0 option")
logging.info("Exiting due to -1 or -0 option")
exit()
c = ConditionChecker(
forbidFiles=opts.forbid_file,
Expand Down
5 changes: 5 additions & 0 deletions rguard.service
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
Description=Reboot Guard

[Service]
# With the following default example, shutdown will ALWAYS be blocked
# This is because the "false" command will never succeed
# In this case, shutdown can only be unblocked by manually stopping/killing rguard.service
ExecStart=/usr/sbin/rguard --run false --interval 86400
#
# NOTE: The following ExecStart lines are EXAMPLES only; modify to suit your needs
# There should be only ONE uncommented ExecStart line
#
Expand Down

0 comments on commit 65813a7

Please sign in to comment.