Added manual page and options for readbootlog.

This commit is contained in:
Jesse Smith 2018-11-12 20:53:52 -04:00
parent 7c1a8d932a
commit 5d3815b0ff
5 changed files with 96 additions and 55 deletions

View File

@ -48,6 +48,12 @@ sysvinit (2.92) unreleased; urgency=low
style formating.
Closes Debian bug #571590
Thanks to Philipp Marek for the patch.
* Added new tool (readbootlog) which will read the /var/log/boot file
produced by bootlogd. The output is displayed cleaned up so there
are no control characters. This avoids the need to use sed or related
tools to try to clean up the contents of the log.
* Added manual page for readbootlog program.
sysvinit (2.91) world; urgency=low

View File

@ -1,52 +0,0 @@
'\" -*- coding: UTF-8 -*-
.\" Copyright (C) 1998-1999 Miquel van Smoorenburg.
.\"
.\" This program is free software; you can redistribute it and/or modify
.\" it under the terms of the GNU General Public License as published by
.\" the Free Software Foundation; either version 2 of the License, or
.\" (at your option) any later version.
.\"
.\" This program is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public License
.\" along with this program; if not, write to the Free Software
.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
.\"
.TH BOOTLOGD 8 "Aug 24, 1999" "" "Linux System Administrator's Manual"
.SH NAME
bootlogd \- record boot messages
.SH SYNOPSIS
.B /sbin/bootlogd
.RB [ \-d ]
.RB [ \-r ]
.RB [ \-v ]
.RB [ " -l logfile " ]
.RB [ " -p pidfile " ]
.SH DESCRIPTION
\fBBootlogd\fP runs in the background and copies all strings sent to the
\fI/dev/console\fP device to a logfile. If the logfile is not accessible,
the messages will be buffered in-memory until it is.
.SH OPTIONS
.IP \fB\-d\fP
Do not fork and run in the background.
.IP \fB\-r\fP
If there is an existing logfile called \fIlogfile\fP rename it to
\fIlogfile~\fP unless \fIlogfile~\fP already exists.
.IP \fB\-v\fP
Show version.
.IP \fB\-l logfile\fP
Log to this logfile. The default is \fI/var/log/boot.log\fP.
.IP \fB\-p pidfile\fP
Put process-id in this file. The default is no pidfile.
.SH NOTES
There is no standard way to find out the real console device if you have
a new-style \fI/dev/console\fP device (major 5, minor 1). \fBBootlogd\fP
might have some difficulties to do this, especially under very old
or very new kernels.
.SH AUTHOR
Miquel van Smoorenburg, miquels@cistron.nl
.SH "SEE ALSO"
.BR dmesg (8)

58
man/readbootlog.1 Normal file
View File

@ -0,0 +1,58 @@
'\" -*- coding: UTF-8 -*-
.\" Copyright (C) 1998-2004 Miquel van Smoorenburg.
.\"
.\" This program is free software; you can redistribute it and/or modify
.\" it under the terms of the GNU General Public License as published by
.\" the Free Software Foundation; either version 2 of the License, or
.\" (at your option) any later version.
.\"
.\" This program is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public License
.\" along with this program; if not, write to the Free Software
.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
.\"
.\"{{{}}}
.\"{{{ Title
.TH READBOOTLOG 1 "NOV 12, 2018" "" "Linux System Administrator's Manual"
.\"}}}
.\"{{{ Name
.SH NAME
readbootlog \- show contents of the boot log, stripping away control characters
.\"}}}
.\"{{{ Synopsis
.SH SYNOPSIS
.B readbootlog
.RB [ \-h ]
.RB "[ \-\fBf\fP \fIfile\fP ]"
.br
.\"}}}
.\"{{{ Description
.SH DESCRIPTION
.B readbootlog
is a tool for reading the boot log (by default /var/log/boot). The program
strips away control characters and non-human readable contents from the log
file. Output is dumped to the terminal where it can be piped or redirected
to a file.
.\"}}}
.\"{{{ Options
.SH OPTIONS
.IP "\fB\-f\fP \fIfile\fP"
Tells \fBreadbootlog\fP to use a specific file instead of \fB/var/log/boot\fP.
.IP \fB\-h\fP
Displays a brief help message.
.\"{{{ Files
.SH FILES
/var/log/boot
.\"}}}
.\"{{{ Author
.SH AUTHOR
Jesse Smith <jsmith@resonatingmedia.com>
.\"}}}
.\"{{{ See also
.SH "SEE ALSO"
.BR bootlogd (8)
.\"}}}

View File

@ -24,9 +24,9 @@ MNTPOINT=
# For some known distributions we do not build all programs, otherwise we do.
BIN =
SBIN = init halt shutdown runlevel killall5 fstab-decode
USRBIN = last mesg
USRBIN = last mesg readbootlog
MAN1 = last.1 lastb.1 mesg.1
MAN1 = last.1 lastb.1 mesg.1 readbootlog.1
MAN5 = initscript.5 inittab.5 initctl.5
MAN8 = halt.8 init.8 killall5.8 pidof.8 poweroff.8 reboot.8 runlevel.8
MAN8 += shutdown.8 telinit.8 fstab-decode.8
@ -139,6 +139,9 @@ shutdown: dowall.o shutdown.o utmp.o
bootlogd: LDLIBS += -lutil $(STATIC)
bootlogd: bootlogd.o bootlogd.h
readbootlog: LDLIBS += $(STATIC)
readbootlog: readbootlog.o bootlogd.h
fstab-decode: LDLIBS += $(STATIC)
fstab-decode: fstab-decode.o

View File

@ -1,5 +1,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "bootlogd.h"
#ifndef MAX_LINE
@ -8,7 +10,13 @@
void print_usage()
{
printf("readbootlog reads the system's boot log, stripping away\n");
printf("control characters to make the log human readable.\n\n");
printf("Usage for readbootlog: readbootlog [-h] [-f logfile]\n");
printf("\t\t-h display this help message\n");
printf("\t\t-f <logfile> display a specific boot log file\n");
printf("\t\t default is to use %s\n", LOGFILE);
printf("\n");
}
/*
@ -75,6 +83,24 @@ int main(int argc, char *argv[])
char line[MAX_LINE];
char output[MAX_LINE];
char *status;
int c;
/* check provided options */
while ( (c = getopt(argc, argv, "hf:") ) != EOF)
{
switch (c)
{
case 'h':
print_usage();
exit(0);
case 'f':
log_filename = optarg;
break;
default:
print_usage();
exit(1);
}
} /* done processing arguments */
log_file = fopen(log_filename, "r");
if (log_file)