summaryrefslogtreecommitdiff
path: root/etc/functions/off
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2008-11-19 14:09:15 +0100
committerDaniel Friesel <derf@derf.homelinux.org>2008-11-19 14:09:15 +0100
commit8f46cc3e6dcb46afa2408172b684e3c1d3aaf0a6 (patch)
treef4c3ba530bd710252caa5a16b051a827396731db /etc/functions/off
parentfd21d22a6ff6cc7e3a3c1ad9e223f840c1c65296 (diff)
off: Added -h for help, print commands when simulating
Diffstat (limited to 'etc/functions/off')
-rw-r--r--etc/functions/off16
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