diff options
author | Daniel Friesel <derf@derf.homelinux.org> | 2008-11-19 14:09:15 +0100 |
---|---|---|
committer | Daniel Friesel <derf@derf.homelinux.org> | 2008-11-19 14:09:15 +0100 |
commit | 8f46cc3e6dcb46afa2408172b684e3c1d3aaf0a6 (patch) | |
tree | f4c3ba530bd710252caa5a16b051a827396731db /etc/functions | |
parent | fd21d22a6ff6cc7e3a3c1ad9e223f840c1c65296 (diff) |
off: Added -h for help, print commands when simulating
Diffstat (limited to 'etc/functions')
-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 |