9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "Russ Cox" <rsc@plan9.bell-labs.com>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] Morning Quickies: nontechnical]
Date: Wed, 14 Jun 2000 12:23:28 -0400	[thread overview]
Message-ID: <200006141627.MAA02691@smtp2.fas.harvard.edu> (raw)

	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 <u.h>
#include <libc.h>

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");
}



             reply	other threads:[~2000-06-14 16:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-06-14 16:23 Russ Cox [this message]
  -- strict thread matches above, loose matches on Subject: below --
2000-06-15  7:35 Bernd Kuehl
2000-06-14 17:42 forsyth
2000-06-14 15:47 James G. Stallings II
2000-06-14 16:11 ` Andrey Mirtchovski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200006141627.MAA02691@smtp2.fas.harvard.edu \
    --to=rsc@plan9.bell-labs.com \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).