From 8f46cc3e6dcb46afa2408172b684e3c1d3aaf0a6 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 19 Nov 2008 14:09:15 +0100 Subject: off: Added -h for help, print commands when simulating --- etc/functions/off | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'etc/functions/off') 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 -- cgit v1.2.3