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