Remove obsolete/ directory from tarball. None of it have been useful for many years.
This commit is contained in:
parent
86c85e2330
commit
4811afc88b
@ -83,6 +83,8 @@ sysvinit (2.89) UNRELEASED; urgency=low
|
|||||||
Gislason and Debian.
|
Gislason and Debian.
|
||||||
* Port ifdown.c to FreeBSD. Patch from Guillem Jover and Debian.
|
* Port ifdown.c to FreeBSD. Patch from Guillem Jover and Debian.
|
||||||
* Drop dsf part from version number. It no longer make sense to keep.
|
* Drop dsf part from version number. It no longer make sense to keep.
|
||||||
|
* Remove obsolete/ directory from tarball. None of it have been useful
|
||||||
|
for many years.
|
||||||
|
|
||||||
-- Petter Reinholdtsen <pere@hungry.com> Sun Apr 11 11:28:55 CEST 2010
|
-- Petter Reinholdtsen <pere@hungry.com> Sun Apr 11 11:28:55 CEST 2010
|
||||||
|
|
||||||
|
@ -1,58 +0,0 @@
|
|||||||
WARNING:
|
|
||||||
|
|
||||||
This version of sysvinit is really different from the 2.50 and
|
|
||||||
earlier version.
|
|
||||||
|
|
||||||
Shutdown now puts the system into runlevel 6 (reboot), 0 (halt)
|
|
||||||
or 1 (single user). This can cause unexpected results if you
|
|
||||||
install the binaries from this release into Slackware distributions
|
|
||||||
older than Slackware 3.0.
|
|
||||||
|
|
||||||
SUPPORTED DISTRIBUTIONS:
|
|
||||||
|
|
||||||
The binaries from this package can be installed in:
|
|
||||||
|
|
||||||
o Debian 1.3 and later
|
|
||||||
o RedHat 3.x and later
|
|
||||||
o Slackware 3.0 (UNTESTED but it might work - no complaints yet).
|
|
||||||
Also read the INIT.README in the slackware/ directory.
|
|
||||||
o Slackware 2.x: see the slackware/ directory
|
|
||||||
|
|
||||||
Do not install any of the scripts from the debian/ directory unless
|
|
||||||
you know what you are doing.
|
|
||||||
|
|
||||||
UNSUPPORTED DISTRIBUTIONS:
|
|
||||||
|
|
||||||
o The rest :)
|
|
||||||
|
|
||||||
If you have a non-supported system, please upgrade to the latest version
|
|
||||||
of your distribution that supports the Linux 2.0.x kernel (probably
|
|
||||||
the reason why you are installing this newer sysvinit).
|
|
||||||
|
|
||||||
You might get away by installing *just* the "init" binary, and nothing
|
|
||||||
else. Do _not_ replace your existing halt, reboot or shutdown programs.
|
|
||||||
|
|
||||||
HOW TO NON DESTRUCTIVELY TEST THE NEW INIT:
|
|
||||||
|
|
||||||
Install *just* the init binary as /sbin/init.new. Now reboot the system,
|
|
||||||
and stop your bootloader so you can give arguments on the command line.
|
|
||||||
With LILO you can usually achieve this by keeping the SHIFT key
|
|
||||||
pressed during boot up. Enter the name of the kernel image (for LILO,
|
|
||||||
TAB shows a list) followed by the argument "init=/sbin/init.new".
|
|
||||||
The name "init.new" is special, do not use something like "init.test".
|
|
||||||
|
|
||||||
For example:
|
|
||||||
|
|
||||||
boot: linux init=/sbin/init.new
|
|
||||||
|
|
||||||
YOU CANNOT SHUTDOWN IN A CLEAN WAY AFTER THIS. Your best bet is to use
|
|
||||||
the "-n" flag to shutdown. This is because init is not running as process #1
|
|
||||||
if you use this method. Anyway, if this works, you can remove the old init
|
|
||||||
and copy the new init into place.
|
|
||||||
|
|
||||||
DISCLAIMER:
|
|
||||||
|
|
||||||
If it breaks you get to keep both pieces. If you want to run the latest
|
|
||||||
Linux 2.0.x kernel and you can't get init to work just upgrade your entire
|
|
||||||
distribution to a newer version that supports the 2.0.x kernel properly.
|
|
||||||
|
|
@ -1,67 +0,0 @@
|
|||||||
#! /bin/sh
|
|
||||||
#
|
|
||||||
# bootlogd One of the first scripts to be executed. Starts or stops
|
|
||||||
# the bootlogd log program. If this script is called as
|
|
||||||
# "stop-bootlogd", it will stop the daemon instead of
|
|
||||||
# starting it even when called with the "start" argument.
|
|
||||||
#
|
|
||||||
# Version: @(#)bootlogd 2.77 24-Aug-1999 miquels@cistron.nl
|
|
||||||
#
|
|
||||||
|
|
||||||
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
|
||||||
DAEMON=/sbin/bootlogd
|
|
||||||
NAME=bootlogd
|
|
||||||
DESC="Bootlog daemon"
|
|
||||||
PIDFILE=/var/run/$NAME.pid
|
|
||||||
|
|
||||||
test -f $DAEMON || exit 0
|
|
||||||
|
|
||||||
## set -e # not needed
|
|
||||||
|
|
||||||
. /etc/default/rcS
|
|
||||||
|
|
||||||
case "$0" in
|
|
||||||
*stop-bootlog*)
|
|
||||||
stopper=yes
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
start|stop)
|
|
||||||
if [ "$stopper" ] || [ "$1" = "stop" ]
|
|
||||||
then
|
|
||||||
echo -n "Stopping $DESC: "
|
|
||||||
start-stop-daemon --stop --quiet --exec $DAEMON
|
|
||||||
else
|
|
||||||
echo -n "Starting $DESC: "
|
|
||||||
start-stop-daemon --start --quiet --exec $DAEMON -- -r
|
|
||||||
fi
|
|
||||||
if [ "$stopper" ] && [ -f /var/log/boot.log ] && \
|
|
||||||
[ -f /var/log/boot.log~ ]
|
|
||||||
then
|
|
||||||
cd /var/log
|
|
||||||
savelog -p -c 5 boot.log > /dev/null 2>&1
|
|
||||||
mv boot.log.0 boot.log
|
|
||||||
mv boot.log~ boot.log.0
|
|
||||||
fi
|
|
||||||
echo "$NAME."
|
|
||||||
;;
|
|
||||||
restart|force-reload)
|
|
||||||
echo -n "Restarting $DESC: "
|
|
||||||
start-stop-daemon --stop --quiet --pidfile \
|
|
||||||
$PIDFILE --exec $DAEMON -- -p $PIDFILE
|
|
||||||
sleep 1
|
|
||||||
start-stop-daemon --start --quiet --pidfile \
|
|
||||||
$PIDFILE --exec $DAEMON -- -p $PIDFILE
|
|
||||||
echo "$NAME."
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
N=${0##*/}
|
|
||||||
N=${N#[SK]??}
|
|
||||||
echo "Usage: $N {start|stop|restart|force-reload}" >&2
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
exit 0
|
|
||||||
|
|
@ -1,73 +0,0 @@
|
|||||||
'\" -*- coding: UTF-8 -*-
|
|
||||||
.\" Copyright (C) 1994 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 POWERD 8 "Feb 14, 1994" "" "Linux System Administrator's Manual"
|
|
||||||
.SH NAME
|
|
||||||
.\" powerd \(em monitor a serial line connected to an UPS.
|
|
||||||
powerd -- monitor a serial line connected to an UPS.
|
|
||||||
.SH SYNOPSIS
|
|
||||||
.B /sbin/powerd
|
|
||||||
.RB " serial-device "
|
|
||||||
.SH DESCRIPTION
|
|
||||||
.B Powerd
|
|
||||||
is a daemon process that sits in the background and monitors the state
|
|
||||||
of the DCD line of the serial device. This line is meant to be
|
|
||||||
connected to a UPS (Uninterruptible Power Supply) so that \fBpowerd\fP knows
|
|
||||||
about the state of the UPS. As soon as \fBpowerd\fP senses that the
|
|
||||||
power is failing (it sees that DCD goes low) it notifies \fBinit\fP(8),
|
|
||||||
and \fBinit\fP then executes the \fBpowerwait\fP and \fBpowerfail\fP entries.
|
|
||||||
If \fBpowerd\fP senses that the power has been restored, it notifies \fBinit\fP
|
|
||||||
again and \fBinit\fP will execute the \fBpowerokwait\fP entries.
|
|
||||||
.SH ARGUMENTS
|
|
||||||
.IP serial-device
|
|
||||||
Some serial port that is not being used by some other device, and does not
|
|
||||||
share an interrupt with any other serial port.
|
|
||||||
.SH DIAGNOSTICS
|
|
||||||
\fBPowerd\fP regularly checks the \fBDSR\fP line to see if it's high.
|
|
||||||
\fBDSR\fP should be directly connected to \fBDTR\fP and \fBpowerd\fP
|
|
||||||
keeps that line high, so if \fBDSR\fP is low then something is wrong
|
|
||||||
with the connection. \fBPowerd\fP will notify you about this fact every
|
|
||||||
two minutes. When it sees that the connection has been restored it
|
|
||||||
will say so.
|
|
||||||
.SH HOWTO
|
|
||||||
It's pretty simple to connect your UPS to the Linux machine. The steps
|
|
||||||
are easy:
|
|
||||||
.TP 0.5i
|
|
||||||
.B 1.
|
|
||||||
Make sure you have an UPS with a simple relay output: it should
|
|
||||||
close its connections (make) if the power is gone, and it should
|
|
||||||
open its connections (break) if the power is good.
|
|
||||||
.TP 0.5i
|
|
||||||
.B 2.
|
|
||||||
Buy a serial plug. Connect the DTR line to the DSR line directly.
|
|
||||||
Connect the DTR line and the DCD line with a \fB10 kilo ohm\fP
|
|
||||||
resistor. Now connect the relay output of the UPS to GROUND
|
|
||||||
and the DCD line. If you don't know what pins DSR, DTR, DCD and
|
|
||||||
GROUND are you can always ask at the store where you bought the plug.
|
|
||||||
.TP 0.5i
|
|
||||||
.B 3.
|
|
||||||
You're all set.
|
|
||||||
.SH BUGS
|
|
||||||
Well, not a real bug but \fBpowerd\fP should be able to do a broadcast or
|
|
||||||
something on the ethernet in case more Linux-boxes are connected to
|
|
||||||
the same UPS and only one of them is connected to the UPS status line.
|
|
||||||
.SH SEE ALSO
|
|
||||||
.BR shutdown (8),
|
|
||||||
.BR init (8),
|
|
||||||
.BR inittab (5)
|
|
||||||
.SH AUTHOR
|
|
||||||
Miquel van Smoorenburg, miquels@cistron.nl
|
|
@ -1,36 +0,0 @@
|
|||||||
There are 2 *much* better powerd's than the one that is included as
|
|
||||||
an example with sysvinit. The powerd.c in this distribution is just ment
|
|
||||||
as a programming example, not to be used in a real life situation.
|
|
||||||
|
|
||||||
1. GENPOWERD.
|
|
||||||
|
|
||||||
This is a powerd written by Tom Webster <webster@kaiwan.com>. It's a
|
|
||||||
nice package, you can find info at http://www.kaiwan.com/~webster/genpower.html
|
|
||||||
|
|
||||||
2. POWERD-2.0.
|
|
||||||
|
|
||||||
This is another powerd, written by rubini@ipvvis.unipv.it (Alessandro Rubini).
|
|
||||||
The main advantage over genpowerd is that it can signal other machines over
|
|
||||||
the network.
|
|
||||||
|
|
||||||
This LSM may be out of date. Please check if a newer version exists.
|
|
||||||
|
|
||||||
Begin3
|
|
||||||
Title: powerd
|
|
||||||
Version: 2.0
|
|
||||||
Entered-date: Sep 26 1995
|
|
||||||
Description: A daemon to shut down and up computers connected to ups's.
|
|
||||||
Network-aware: server-mode and client-mode allowed.
|
|
||||||
Keywords: ups, powerd, init
|
|
||||||
Author: Alessandro Rubini (based on Miquel van Smoorenburg's work).
|
|
||||||
Maintained-by: rubini@ipvvis.unipv.it (Alessandro Rubini)
|
|
||||||
Primary-site: sunsite.unc.edu /pub/Linux/system/UPS/powerd-2.0.tar.gz
|
|
||||||
25kB powerd-2.0.tar.gz
|
|
||||||
1kB powerd-2.0.lsm
|
|
||||||
Alternate-site:
|
|
||||||
Original-site: iride.unipv.it /pub/linux
|
|
||||||
25kB powerd-2.0.tar.gz
|
|
||||||
1kB powerd-2.0.lsm
|
|
||||||
Platform: Linux. Porting is foreseeable.
|
|
||||||
Copying-policy: GPL
|
|
||||||
End
|
|
@ -1,201 +0,0 @@
|
|||||||
/*
|
|
||||||
* powerd Monitor the DCD line of a serial port connected to
|
|
||||||
* an UPS. If the power goes down, notify init.
|
|
||||||
* If the power comes up again, notify init again.
|
|
||||||
* As long as the power is OK, the DCD line should be
|
|
||||||
* "HIGH". When the power fails, DCD should go "LOW".
|
|
||||||
* Powerd keeps DTR high so that you can connect
|
|
||||||
* DCD and DTR with a resistor of 10 Kilo Ohm and let the
|
|
||||||
* UPS or some relais pull the DCD line to ground.
|
|
||||||
* You also need to connect DTR and DSR together. This
|
|
||||||
* way, powerd can check now and then if DSR is high
|
|
||||||
* so it knows the UPS is connected!!
|
|
||||||
*
|
|
||||||
* Usage: powerd /dev/cua4 (or any other serial device).
|
|
||||||
*
|
|
||||||
* Author: Miquel van Smoorenburg, <miquels@drinkel.cistron.nl>.
|
|
||||||
*
|
|
||||||
* Version: 1.31, 29-Feb-1996.
|
|
||||||
*
|
|
||||||
* This program was originally written for my employer,
|
|
||||||
* ** Cistron Electronics **
|
|
||||||
* who has given kind permission to release this program
|
|
||||||
* for general puppose.
|
|
||||||
*
|
|
||||||
* Copyright (C) 1991-1996 Cistron Electronics.
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Use the new way of communicating with init. */
|
|
||||||
#define NEWINIT
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <sys/ioctl.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <signal.h>
|
|
||||||
#include <syslog.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include "paths.h"
|
|
||||||
#ifdef NEWINIT
|
|
||||||
#include "initreq.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef SIGPWR
|
|
||||||
# define SIGPWR SIGUSR1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef NEWINIT
|
|
||||||
void alrm_handler()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Tell init the power has either gone or is back. */
|
|
||||||
void powerfail(ok)
|
|
||||||
int ok;
|
|
||||||
{
|
|
||||||
int fd;
|
|
||||||
#ifdef NEWINIT
|
|
||||||
struct init_request req;
|
|
||||||
|
|
||||||
/* Fill out the request struct. */
|
|
||||||
memset(&req, 0, sizeof(req));
|
|
||||||
req.magic = INIT_MAGIC;
|
|
||||||
req.cmd = ok ? INIT_CMD_POWEROK : INIT_CMD_POWERFAIL;
|
|
||||||
|
|
||||||
/* Open the fifo (with timeout) */
|
|
||||||
signal(SIGALRM, alrm_handler);
|
|
||||||
alarm(3);
|
|
||||||
if ((fd = open(INIT_FIFO, O_WRONLY)) >= 0
|
|
||||||
&& write(fd, &req, sizeof(req)) == sizeof(req)) {
|
|
||||||
close(fd);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
/* Fall through to the old method.. */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Create an info file for init. */
|
|
||||||
unlink(PWRSTAT);
|
|
||||||
if ((fd = open(PWRSTAT, O_CREAT|O_WRONLY, 0644)) >= 0) {
|
|
||||||
if (ok)
|
|
||||||
write(fd, "OK\n", 3);
|
|
||||||
else
|
|
||||||
write(fd, "FAIL\n", 5);
|
|
||||||
close(fd);
|
|
||||||
}
|
|
||||||
kill(1, SIGPWR);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Main program. */
|
|
||||||
int main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
int fd;
|
|
||||||
int dtr_bit = TIOCM_DTR;
|
|
||||||
int flags;
|
|
||||||
int status, oldstat = -1;
|
|
||||||
int count = 0;
|
|
||||||
int tries = 0;
|
|
||||||
|
|
||||||
if (argc < 2) {
|
|
||||||
fprintf(stderr, "Usage: powerd <device>\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Start syslog. */
|
|
||||||
openlog("powerd", LOG_CONS|LOG_PERROR, LOG_DAEMON);
|
|
||||||
|
|
||||||
/* Open monitor device. */
|
|
||||||
if ((fd = open(argv[1], O_RDWR | O_NDELAY)) < 0) {
|
|
||||||
syslog(LOG_ERR, "%s: %s", argv[1], sys_errlist[errno]);
|
|
||||||
closelog();
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Line is opened, so DTR is high. Force it anyway to be sure. */
|
|
||||||
ioctl(fd, TIOCMBIS, &dtr_bit);
|
|
||||||
|
|
||||||
/* Daemonize. */
|
|
||||||
switch(fork()) {
|
|
||||||
case 0: /* Child */
|
|
||||||
closelog();
|
|
||||||
setsid();
|
|
||||||
break;
|
|
||||||
case -1: /* Error */
|
|
||||||
syslog(LOG_ERR, "can't fork.");
|
|
||||||
closelog();
|
|
||||||
exit(1);
|
|
||||||
default: /* Parent */
|
|
||||||
closelog();
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Restart syslog. */
|
|
||||||
openlog("powerd", LOG_CONS, LOG_DAEMON);
|
|
||||||
|
|
||||||
/* Now sample the DCD line. */
|
|
||||||
while(1) {
|
|
||||||
/* Get the status. */
|
|
||||||
ioctl(fd, TIOCMGET, &flags);
|
|
||||||
|
|
||||||
/* Check the connection: DSR should be high. */
|
|
||||||
tries = 0;
|
|
||||||
while((flags & TIOCM_DSR) == 0) {
|
|
||||||
/* Keep on trying, and warn every two minutes. */
|
|
||||||
if ((tries % 60) == 0)
|
|
||||||
syslog(LOG_ALERT, "UPS connection error");
|
|
||||||
sleep(2);
|
|
||||||
tries++;
|
|
||||||
ioctl(fd, TIOCMGET, &flags);
|
|
||||||
}
|
|
||||||
if (tries > 0)
|
|
||||||
syslog(LOG_ALERT, "UPS connection OK");
|
|
||||||
|
|
||||||
/* Calculate present status. */
|
|
||||||
status = (flags & TIOCM_CAR);
|
|
||||||
|
|
||||||
/* Did DCD drop to zero? Then the power has failed. */
|
|
||||||
if (oldstat != 0 && status == 0) {
|
|
||||||
count++;
|
|
||||||
if (count > 3)
|
|
||||||
powerfail(0);
|
|
||||||
else {
|
|
||||||
sleep(1);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* Did DCD come up again? Then the power is back. */
|
|
||||||
if (oldstat == 0 && status > 0) {
|
|
||||||
count++;
|
|
||||||
if (count > 3)
|
|
||||||
powerfail(1);
|
|
||||||
else {
|
|
||||||
sleep(1);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* Reset count, remember status and sleep 2 seconds. */
|
|
||||||
count = 0;
|
|
||||||
oldstat = status;
|
|
||||||
sleep(2);
|
|
||||||
}
|
|
||||||
/* Never happens */
|
|
||||||
return(0);
|
|
||||||
}
|
|
@ -1,58 +0,0 @@
|
|||||||
# Example configuration for power daemon.
|
|
||||||
# NOTE: this is not implemented yet, just a design.
|
|
||||||
#
|
|
||||||
# @(#) powerd.cfg 1.01 01-Oct-1994 MvS
|
|
||||||
#
|
|
||||||
|
|
||||||
# This is the setup section. It sets up the default line
|
|
||||||
# signals that your UPS likes to see.
|
|
||||||
[ setup ]
|
|
||||||
dtr = 1
|
|
||||||
rts = 1
|
|
||||||
baud = 2400
|
|
||||||
send "AAAA"
|
|
||||||
|
|
||||||
# Now: how to tell UPS to turn off the power.
|
|
||||||
[ powerdown ]
|
|
||||||
dtr = 0
|
|
||||||
send "BYE"
|
|
||||||
|
|
||||||
# How to monitor the UPS, or a remote UPS.
|
|
||||||
# Possible line signals: dcd cts dsr ring
|
|
||||||
#
|
|
||||||
# Comment out the parts you don't want.
|
|
||||||
#
|
|
||||||
# All of this (1, 2, 3) can be combined.
|
|
||||||
[ monitor ]
|
|
||||||
|
|
||||||
# First, do we want to broadcast the UPS status
|
|
||||||
# on ethernet when something happens?
|
|
||||||
# Comment out to disable.
|
|
||||||
# Syntax: address, portnumber
|
|
||||||
# address: broadcast adress on ethernet
|
|
||||||
# portnumber: unused priviliged port (under 1024)
|
|
||||||
broadcast = 10.0.33.255,15
|
|
||||||
|
|
||||||
# monitor type 1. This tells powerd to monitor line signals.
|
|
||||||
ok = dcd
|
|
||||||
fail = !dcd
|
|
||||||
lowbat = rts
|
|
||||||
|
|
||||||
# Monitor type 2. Tell powerd to look for data.
|
|
||||||
ok = "OK"
|
|
||||||
fail = "!"
|
|
||||||
|
|
||||||
# Monitor type 3. Listen to the ethernet.
|
|
||||||
#
|
|
||||||
# Warn_host is the hostname of the system with the UPS
|
|
||||||
# This is for security, so that someone on a DOS box
|
|
||||||
# can't spoof the powerd broadcast. The number after it
|
|
||||||
# is the portnumber to listen to (see above: broadcast).
|
|
||||||
#
|
|
||||||
# Note: if the broadcast address set above is enabled
|
|
||||||
# and we receive a message from a remote powerd, we check
|
|
||||||
# the received broadcast address. If this is the same
|
|
||||||
# as from the broadcast we just received,
|
|
||||||
# it will not be repeated (guess why).
|
|
||||||
remote = warn_host,15
|
|
||||||
|
|
@ -1,70 +0,0 @@
|
|||||||
/*
|
|
||||||
* utmpdump Simple program to dump UTMP and WTMP files in
|
|
||||||
* raw format, so they can be examined.
|
|
||||||
*
|
|
||||||
* Version: @(#)utmpdump.c 13-Aug-1996 1.00 miquels@cistron.nl
|
|
||||||
*
|
|
||||||
* This file is part of the sysvinit suite,
|
|
||||||
* Copyright (C) 1991-1996 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
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <utmp.h>
|
|
||||||
#include <time.h>
|
|
||||||
|
|
||||||
void dump(fp)
|
|
||||||
FILE *fp;
|
|
||||||
{
|
|
||||||
struct utmp ut;
|
|
||||||
int f;
|
|
||||||
time_t tm;
|
|
||||||
|
|
||||||
while (fread(&ut, sizeof(struct utmp), 1, fp) == 1) {
|
|
||||||
for(f = 0; f < 12; f++) if (ut.ut_line[f] == ' ') ut.ut_line[f] = '_';
|
|
||||||
for(f = 0; f < 8; f++) if (ut.ut_name[f] == ' ') ut.ut_name[f] = '_';
|
|
||||||
tm = ut.ut_time;
|
|
||||||
printf("[%d] [%05d] [%-4.4s] [%-8.8s] [%-12.12s] [%-15.15s]\n",
|
|
||||||
ut.ut_type, ut.ut_pid, ut.ut_id, ut.ut_user,
|
|
||||||
ut.ut_line, 4 + ctime(&tm));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(argc, argv)
|
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
{
|
|
||||||
int f;
|
|
||||||
FILE *fp;
|
|
||||||
|
|
||||||
if (argc < 2) {
|
|
||||||
argc = 2;
|
|
||||||
argv[1] = UTMP_FILE;
|
|
||||||
}
|
|
||||||
|
|
||||||
for(f = 1; f < argc; f++) {
|
|
||||||
if (strcmp(argv[f], "-") == 0) {
|
|
||||||
printf("Utmp dump of stdin\n");
|
|
||||||
dump(stdin);
|
|
||||||
} else if ((fp = fopen(argv[f], "r")) != NULL) {
|
|
||||||
printf("Utmp dump of %s\n", argv[f]);
|
|
||||||
dump(fp);
|
|
||||||
fclose(fp);
|
|
||||||
} else
|
|
||||||
perror(argv[f]);
|
|
||||||
}
|
|
||||||
return(0);
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user