aboutsummaryrefslogtreecommitdiff
path: root/sbin/shutdown
diff options
context:
space:
mode:
authorJoseph Koshy <jkoshy@FreeBSD.org>1999-06-21 06:21:05 +0000
committerJoseph Koshy <jkoshy@FreeBSD.org>1999-06-21 06:21:05 +0000
commit1d4f4c0d21f6686d21178d0ac5112178a709f179 (patch)
tree0aa1eb3e0df5134604c597122d1e7bb17eda8398 /sbin/shutdown
parent53a03d1c97590218458479f375b6adbfb3cb790d (diff)
downloadsrc-1d4f4c0d21f6686d21178d0ac5112178a709f179.tar.gz
src-1d4f4c0d21f6686d21178d0ac5112178a709f179.zip
Minor cleanups to shutdown(8):
- Make the -k "don't actually halt" flag incompatible with the halt/reboot options -h, -p, and -r. - The -n "don't sync" option is ignored if -k is specified. Issue a warning message. - Compute the actual shutdown time written to /var/run/nologin correctly in the case of "now" being specified.
Notes
Notes: svn path=/head/; revision=48062
Diffstat (limited to 'sbin/shutdown')
-rw-r--r--sbin/shutdown/shutdown.813
-rw-r--r--sbin/shutdown/shutdown.c14
2 files changed, 22 insertions, 5 deletions
diff --git a/sbin/shutdown/shutdown.8 b/sbin/shutdown/shutdown.8
index 70d6044c8ae1..90041f52e174 100644
--- a/sbin/shutdown/shutdown.8
+++ b/sbin/shutdown/shutdown.8
@@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)shutdown.8 8.2 (Berkeley) 4/27/95
-.\" $Id: shutdown.8,v 1.8 1998/12/11 10:35:38 bde Exp $
+.\" $Id: shutdown.8,v 1.9 1999/01/11 09:07:42 asami Exp $
.\"
.Dd Dec 11, 1998
.Dt SHUTDOWN 8
@@ -71,6 +71,9 @@ system multi-user with logins disabled (for all but super-user).
Prevent the normal
.Xr sync 2
before stopping.
+This option is ignored if
+.Fl k
+is specified.
.It Fl p
The system will turn the power off after shutdown if it can.
.It Fl r
@@ -105,6 +108,14 @@ is supplied as an option, the warning message is read from the standard
input.
.El
.Pp
+Only one of
+.Fl h ,
+.Fl k ,
+.Fl p ,
+and
+.Fl r
+can be specified at a time.
+.Pp
At intervals, becoming more frequent as apocalypse approaches
and starting at ten hours before shutdown, warning messages are displayed
on the terminals of all users logged in. Five minutes before
diff --git a/sbin/shutdown/shutdown.c b/sbin/shutdown/shutdown.c
index 03a1866b1da2..8f9e7c851709 100644
--- a/sbin/shutdown/shutdown.c
+++ b/sbin/shutdown/shutdown.c
@@ -42,7 +42,7 @@ static const char copyright[] =
static char sccsid[] = "@(#)shutdown.c 8.4 (Berkeley) 4/28/95";
#endif
static const char rcsid[] =
- "$Id: shutdown.c,v 1.16 1998/12/11 11:21:47 bde Exp $";
+ "$Id: shutdown.c,v 1.17 1999/06/18 14:26:07 ru Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -151,10 +151,14 @@ main(argc, argv)
if (argc < 1)
usage();
- if (doreboot + dohalt + dopower > 1) {
- warnx("incompatible switches -h, -p and -r");
+ if (killflg + doreboot + dohalt + dopower > 1) {
+ warnx("incompatible switches -h, -k, -p and -r");
usage();
}
+
+ if (killflg && nosync)
+ warnx("option -n ignored with -k");
+
getoffset(*argv++);
if (*argv) {
@@ -383,12 +387,14 @@ getoffset(timearg)
time_t now;
int this_year;
+ (void)time(&now);
+
if (!strcasecmp(timearg, "now")) { /* now */
offset = 0;
+ shuttime = now;
return;
}
- (void)time(&now);
if (*timearg == '+') { /* +minutes */
if (!isdigit(*++timearg))
badtime();