-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathrguard.service
36 lines (34 loc) · 1.7 KB
/
rguard.service
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
[Unit]
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
#
##ExecStart=/usr/sbin/rguard --interval 30 --require-file /run/.allow-shutdown
##ExecStart=/usr/sbin/rguard --ignore-signals --unit atd -u crond --cmd mysqld
##ExecStart=/usr/sbin/rguard --cmd gnome-session --forbid-file '/some/lock file'
##ExecStart=/usr/sbin/rguard --run 'ping -c2 -w1 -W1 www.redhat.com'
##ExecStart=/usr/sbin/rguard --loglevel info --run '!findmnt /mountpoint'
##ExecStart=/usr/sbin/rguard --loglevel debug --run '!@lsof -i:ssh | grep -q ESTABLISHED'
#
# Keep in mind:
# * --loglevel is optional (defaults to warning; use info or debug to see more detail)
# * --ignore-signals is optional (without it, `systemctl stop rguard` or `killall rguard` will remove the blocks)
# * --interval is optional (defaults to 60 secs; useful to bump up when testing)
# * Condition-checking options can be used more than once
# * Any arguments with spaces should be double- or single-quoted
# * If passing a shell command to --run, prefix with "@"
# * To invert the interpretation of --run, prefix with "!"
# * If using both "@" and "!", order should be "!@"
# * See rguard --help for more detail
#
TimeoutStopSec=5
# Optionally uncomment the following line to prevent systemd from killing rguard
##SendSIGKILL=no
[Install]
WantedBy=multi-user.target