-.\" $OpenBSD: shutdown.8,v 1.39 2007/11/19 08:51:49 jmc Exp $
+.\" $OpenBSD: shutdown.8,v 1.40 2015/01/21 19:29:52 naddy Exp $
.\" $NetBSD: shutdown.8,v 1.6 1995/03/18 15:01:07 cgd Exp $
.\"
.\" Copyright (c) 1988, 1991, 1993
.\"
.\" @(#)shutdown.8 8.1 (Berkeley) 6/5/93
.\"
-.Dd $Mdocdate: November 19 2007 $
+.Dd $Mdocdate: January 21 2015 $
.Dt SHUTDOWN 8
.Os
.Sh NAME
.Bl -tag -width Ds
.It Fl d
When used with
-.Fl h
+.Fl h ,
+.Fl p ,
or
.Fl r
causes system to perform a dump.
system multi-user with logins disabled (for all but superuser).
.It Fl n
When used with
-.Fl h
+.Fl h ,
+.Fl p ,
or
.Fl r
prevents the normal
.Xr sync 2
before stopping the system.
.It Fl p
+The system is powered down at the specified
+.Ar time .
The
.Fl p
flag is passed on to
-/* $OpenBSD: shutdown.c,v 1.38 2015/01/16 06:40:01 deraadt Exp $ */
+/* $OpenBSD: shutdown.c,v 1.39 2015/01/21 19:29:52 naddy Exp $ */
/* $NetBSD: shutdown.c,v 1.9 1995/03/18 15:01:09 cgd Exp $ */
/*
"shutdown: incompatible switches -h and -r.\n");
usage();
}
- if (dopower && !dohalt) {
+ if (doreboot && dopower) {
(void)fprintf(stderr,
- "shutdown: switch -p must be used with -h.\n");
+ "shutdown: incompatible switches -p and -r.\n");
usage();
}
getoffset(*argv++);
{
syslog(LOG_NOTICE, "%s by %s: %s",
- doreboot ? "reboot" : dohalt ? "halt" : "shutdown", whom, mbuf);
+ doreboot ? "reboot" : dopower ? "power-down" : dohalt ? "halt" :
+ "shutdown", whom, mbuf);
(void)sleep(2);
(void)printf("\r\nSystem shutdown time has arrived\007\007\r\n");
#ifdef DEBUG
if (doreboot)
(void)printf("reboot");
+ else if (dopower)
+ (void)printf("power-down");
else if (dohalt)
(void)printf("halt");
if (nosync)
syslog(LOG_ERR, "shutdown: can't exec %s: %m.", _PATH_REBOOT);
warn(_PATH_REBOOT);
}
- else if (dohalt) {
+ else if (dohalt || dopower) {
execle(_PATH_HALT, "halt", "-l",
(dopower ? "-p" : (nosync ? "-n" : (dodump ? "-d" : NULL))),
(nosync ? "-n" : (dodump ? "-d" : NULL)),
void
usage(void)
{
- fprintf(stderr, "usage: shutdown [-] [-dfhknpr] time [warning-message ...]\n");
+ fprintf(stderr,
+ "usage: shutdown [-] [-dfhknpr] time [warning-message ...]\n");
exit(1);
}