xref: /inferno-os/dis/shutdown (revision 0d94c0ebb687f41ba3cae09e19739cc0a7a31aed)
1#!/dis/sh
2load std
3x=$*
4{~ $#x 1 && ~ ${hd $x} -h -r} || {echo usage: shutdown -h or shutdown -r >[1=2]; exit usage}
5# the following is a bit pointless until kfs has halt
6#ftest -f /dis/disk/kfscmd.dis && {
7#	for(a in /chan/kfs.*.cmd){
8#		b=${hd ${tl ${split '.' $a}}}
9#		~ $b '*' || disk/kfscmd -n $b halt
10#	}
11#}
12if {~ $1 -r} {
13	echo reboot >/dev/sysctl
14} {~ $1 -h} {
15	echo halt >/dev/sysctl
16} {}
17echo shutdown: failed: $status >[1=2]
18exit failed
19