diff options
-rw-r--r-- | etc/functions/off | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/etc/functions/off b/etc/functions/off index fdab3d6..e974c8a 100644 --- a/etc/functions/off +++ b/etc/functions/off @@ -6,7 +6,11 @@ typeset tune2fs typeset -i force reboot simulate function execute { - (( simulate )) || $* + if (( simulate )) { + echo $* + } else { + $* + } } while [[ $1 == -* ]] { @@ -14,6 +18,16 @@ while [[ $1 == -* ]] { -n) simulate=1 ;; -r) reboot=1 ;; --force) force=1 ;; + -h) + print 'off - shutdown / restart the system' + print 'Usage: off [--force] [-hnr]' + print 'Options:\n' + print ' -n simulate. Do not actually shutdown' + print ' -r reboot' + print ' -h show this message' + print '\--force shutdown even if the machine is a server' + return 0 + ;; *) fdie "Unrecognized option: $1"; return 1 ;; esac shift |