Add flags -v, -x, and -z for verbose, debug, and silent shutdowns,
respectively, by passing flags AB_VERBOSE, AB_DEBUG, and/or AB_SILENT to reboot(2).
This commit is contained in:
parent
51495ed0e7
commit
00ef49e965
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: reboot.8,v 1.27 2010/12/12 11:38:42 pooka Exp $
|
||||
.\" $NetBSD: reboot.8,v 1.28 2011/02/16 17:53:31 dyoung Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1990, 1991, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
@ -29,7 +29,7 @@
|
||||
.\"
|
||||
.\" @(#)reboot.8 8.1 (Berkeley) 6/9/93
|
||||
.\"
|
||||
.Dd October 21, 2008
|
||||
.Dd February 16, 2011
|
||||
.Dt REBOOT 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -81,6 +81,27 @@ If the powerdown fails, or the system does not support
|
||||
software powerdown, the system will halt.
|
||||
This option is only valid for
|
||||
.Nm halt .
|
||||
.It Fl v
|
||||
To enable verbose messages on the console, pass the
|
||||
.Xr boothowto 9
|
||||
flag
|
||||
.Dv AB_VERBOSE
|
||||
to
|
||||
.Xr reboot 2 .
|
||||
.It Fl x
|
||||
To enable debugging messages on the console, pass the
|
||||
.Xr boothowto 9
|
||||
flag
|
||||
.Dv AB_DEBUG
|
||||
to
|
||||
.Xr reboot 2 .
|
||||
.It Fl z
|
||||
To silence some shutdown messages on the console, pass the
|
||||
.Xr boothowto 9
|
||||
flag
|
||||
.Dv AB_SILENT
|
||||
to
|
||||
.Xr reboot 2 .
|
||||
.It Fl q
|
||||
Do not give processes a chance to shut down before halting or restarting.
|
||||
This option should not normally be used.
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: reboot.c,v 1.36 2008/07/20 01:20:23 lukem Exp $ */
|
||||
/* $NetBSD: reboot.c,v 1.37 2011/02/16 17:53:31 dyoung Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
@ -40,7 +40,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1986, 1993\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)reboot.c 8.1 (Berkeley) 6/5/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: reboot.c,v 1.36 2008/07/20 01:20:23 lukem Exp $");
|
||||
__RCSID("$NetBSD: reboot.c,v 1.37 2011/02/16 17:53:31 dyoung Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -85,7 +85,7 @@ main(int argc, char *argv[])
|
||||
} else
|
||||
howto = 0;
|
||||
lflag = nflag = qflag = 0;
|
||||
while ((ch = getopt(argc, argv, "dlnpq")) != -1)
|
||||
while ((ch = getopt(argc, argv, "dlnpqvxz")) != -1)
|
||||
switch(ch) {
|
||||
case 'd':
|
||||
howto |= RB_DUMP;
|
||||
@ -105,6 +105,15 @@ main(int argc, char *argv[])
|
||||
case 'q':
|
||||
qflag = 1;
|
||||
break;
|
||||
case 'v':
|
||||
howto |= AB_VERBOSE;
|
||||
break;
|
||||
case 'x':
|
||||
howto |= AB_DEBUG;
|
||||
break;
|
||||
case 'z':
|
||||
howto |= AB_SILENT;
|
||||
break;
|
||||
case '?':
|
||||
default:
|
||||
usage();
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: shutdown.8,v 1.28 2008/10/21 02:35:51 lukem Exp $
|
||||
.\" $NetBSD: shutdown.8,v 1.29 2011/02/16 17:53:31 dyoung Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1988, 1991, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
@ -29,7 +29,7 @@
|
||||
.\"
|
||||
.\" @(#)shutdown.8 8.2 (Berkeley) 4/27/95
|
||||
.\"
|
||||
.Dd October 21, 2008
|
||||
.Dd February 16, 2011
|
||||
.Dt SHUTDOWN 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -110,6 +110,27 @@ The system is rebooted at the specified
|
||||
.Ar time ,
|
||||
using
|
||||
.Xr reboot 8 .
|
||||
.It Fl v
|
||||
To enable verbose messages on the console, pass
|
||||
.Fl v
|
||||
to
|
||||
.Xr reboot 8
|
||||
or
|
||||
.Xr halt 8 .
|
||||
.It Fl x
|
||||
To enable debugging messages on the console, pass
|
||||
.Fl x
|
||||
to
|
||||
.Xr reboot 8
|
||||
or
|
||||
.Xr halt 8 .
|
||||
.It Fl z
|
||||
To silence some shutdown messages on the console, pass
|
||||
.Fl z
|
||||
to
|
||||
.Xr reboot 8
|
||||
or
|
||||
.Xr halt 8 .
|
||||
.It Fl D
|
||||
Prevents
|
||||
.Nm
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: shutdown.c,v 1.52 2010/06/09 04:51:53 riz Exp $ */
|
||||
/* $NetBSD: shutdown.c,v 1.53 2011/02/16 17:53:31 dyoung Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1990, 1993
|
||||
@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1990, 1993\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)shutdown.c 8.4 (Berkeley) 4/28/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: shutdown.c,v 1.52 2010/06/09 04:51:53 riz Exp $");
|
||||
__RCSID("$NetBSD: shutdown.c,v 1.53 2011/02/16 17:53:31 dyoung Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -91,6 +91,7 @@ static time_t offset, shuttime;
|
||||
static int dofast, dohalt, doreboot, killflg, nofork, nosync, dodump;
|
||||
static size_t mbuflen;
|
||||
static int dopowerdown;
|
||||
static int dodebug, dosilent, doverbose;
|
||||
static const char *whom;
|
||||
static char mbuf[BUFSIZ];
|
||||
static char *bootstr;
|
||||
@ -120,7 +121,7 @@ main(int argc, char *argv[])
|
||||
if (geteuid())
|
||||
errx(1, "%s: Not super-user", strerror(EPERM));
|
||||
#endif
|
||||
while ((ch = getopt(argc, argv, "b:Ddfhknpr")) != -1)
|
||||
while ((ch = getopt(argc, argv, "b:Ddfhknprvxz")) != -1)
|
||||
switch (ch) {
|
||||
case 'b':
|
||||
bootstr = optarg;
|
||||
@ -149,6 +150,15 @@ main(int argc, char *argv[])
|
||||
case 'r':
|
||||
doreboot = 1;
|
||||
break;
|
||||
case 'v':
|
||||
doverbose = 1;
|
||||
break;
|
||||
case 'x':
|
||||
dodebug = 1;
|
||||
break;
|
||||
case 'z':
|
||||
dosilent = 1;
|
||||
break;
|
||||
case '?':
|
||||
default:
|
||||
usage();
|
||||
@ -370,7 +380,7 @@ die_you_gravy_sucking_pig_dog(void)
|
||||
doitfast();
|
||||
dorcshutdown();
|
||||
if (doreboot || dohalt) {
|
||||
const char *args[16];
|
||||
const char *args[20];
|
||||
const char **arg, *path;
|
||||
#ifndef DEBUG
|
||||
int serrno;
|
||||
@ -384,6 +394,12 @@ die_you_gravy_sucking_pig_dog(void)
|
||||
path = _PATH_HALT;
|
||||
*arg++ = "halt";
|
||||
}
|
||||
if (doverbose)
|
||||
*arg++ = "-v";
|
||||
if (dodebug)
|
||||
*arg++ = "-x";
|
||||
if (dosilent)
|
||||
*arg++ = "-z";
|
||||
if (dodump)
|
||||
*arg++ = "-d";
|
||||
if (nosync)
|
||||
|
Loading…
Reference in New Issue
Block a user