From mboxrd@z Thu Jan 1 00:00:00 1970 Message-Id: <200006141627.MAA02691@smtp2.fas.harvard.edu> To: 9fans@cse.psu.edu Subject: Re: [9fans] Morning Quickies: nontechnical] From: "Russ Cox" Date: Wed, 14 Jun 2000 12:23:28 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Topicbox-Message-UUID: bc67e764-eac8-11e9-9e20-41e7f4b1d025 Finally, is there a way to shut down the system gracefully and reboot from the commandline? If you're booted from a file server, type ^P at a cpu server console, or echo reboot >/dev/reboot. If not, you need to halt the disks first: If you're standing at the machine, type disk/kfscmd halt and then reset the machine. If you want to do everything remotely, I believe the following will suffice (I haven't tried it recently, but it worked four years ago). Russ #include #include void main(void) { int fd; Waitmsg w; fd = open("/dev/reboot", OWRITE); if(fd < 0) sysfatal("open: %r"); switch(fork()) { case -1: sysfatal("fork: %r"); case 0: execl("/bin/disk/kfscmd", "disk/kfscmd", "halt", nil); break; default: wait(&w); break; } fprint(fd, "reboot"); }