summary refs log tree commit diff
path: root/shutdown.sh
diff options
context:
space:
mode:
Diffstat (limited to 'shutdown.sh')
-rwxr-xr-x[-rw-r--r--]shutdown.sh6
1 files changed, 5 insertions, 1 deletions
diff --git a/shutdown.sh b/shutdown.sh
index 1c29be3..20fd707 100644..100755
--- a/shutdown.sh
+++ b/shutdown.sh
@@ -22,7 +22,7 @@ while getopts akrhPHfFnct: opt; do
 done
 shift $(expr $OPTIND - 1)
 
-time=$1; shift
+[ -n "$1" ] && time=$1 && shift
 message="${*:-system is going down}"
 
 if [ "$action" = "cancel" ]; then
@@ -31,6 +31,10 @@ if [ "$action" = "cancel" ]; then
   exit
 fi
 
+if [ ! -w /run/runit/shutdown.pid ]; then
+  echo "Not enough permissions to execute ${0#*/}"
+  exit 1
+fi
 echo $$ >/run/runit/shutdown.pid
 
 case "$time" in