#!/bin/sh # # anopa - Copyright (C) 2015 Olivier Brunel # # aa-shutdown # Copyright (C) 2015 Olivier Brunel # # This file is part of anopa. # # anopa is free software: you can redistribute it and/or modify it under the # terms of the GNU General Public License as published by the Free Software # Foundation, either version 3 of the License, or (at your option) any later # version. # # anopa is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. # See the GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along with # anopa. If not, see http://www.gnu.org/licenses/ # dieusage() { cat << EOF Usage: aa-shutdown [OPTION] -r, --reboot Reboot the machine -H, --halt Halt the machine -p, --poweroff Power off the machine -h, --help Show this help screen and exit -V, --version Show version information and exit EOF exit $1 } dieversion() { cat << EOF aa-shutdown v0.2.0 Copyright (C) 2015 Olivier Brunel - http://jjacky.com/anopa License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. EOF exit 0 } if [ $# -ne 1 ]; then dieusage 1 fi case $1 in -H|--halt) cmd=s ;; -h|--help) dieusage 0 ;; -p|--poweroff) cmd=p ;; -r|--reboot) cmd=r ;; -V|--version) dieversion ;; *) dieusage 1 esac exec s6-svscanctl -${cmd}b /run/services/.scandir