diff options
Diffstat (limited to 'shutdownasap.in')
-rwxr-xr-x | shutdownasap.in | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/shutdownasap.in b/shutdownasap.in index 7cce77e..a902cbf 100755 --- a/shutdownasap.in +++ b/shutdownasap.in @@ -24,8 +24,18 @@ while [ $# -gt 0 ]; do echo 'reboot' >"${tmpDir}/intention" intentionSet=true ;; + '-R') + if [ -r "${tmpDir}/intention" ] \ + && grep -qxF 'shutdown' "${tmpDir}/intention" \ + && [ -r "${tmpDir}/pid" ] \ + && kill -0 "$(cat "${tmpDir}/pid")"; then + exit + fi + echo 'reboot' >"${tmpDir}/intention" + intentionSet=true + ;; *) - >&2 echo 'usage: shutdownasap [-q] [-a|-r]' + >&2 echo 'usage: shutdownasap [-q] [-a|-r|-R]' exit 1 ;; esac |