xref: /netbsd-src/usr.sbin/rwhod/rwhod.8 (revision 9fb66d812c00ebfb445c0b47dea128f32aa6fe96)
1.\" Copyright (c) 1983, 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\" 3. Neither the name of the University nor the names of its contributors
13.\"    may be used to endorse or promote products derived from this software
14.\"    without specific prior written permission.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE.
27.\"
28.\"     from: @(#)rwhod.8	8.2 (Berkeley) 12/11/93
29.\"	$NetBSD: rwhod.8,v 1.20 2005/09/12 18:33:56 wiz Exp $
30.\"
31.Dd September 12, 2005
32.Dt RWHOD 8
33.Os
34.Sh NAME
35.Nm rwhod
36.Nd system status server
37.Sh SYNOPSIS
38.Nm
39.Op Fl i Ar interval
40.Op Fl u Ar user
41.Sh DESCRIPTION
42.Nm
43is the server which maintains the database used by the
44.Xr rwho 1
45and
46.Xr ruptime 1
47programs.
48Its operation is predicated on the ability to
49.Em broadcast
50messages on a network.
51.Pp
52The following options are available:
53.Bl -tag -width XXXXXXXXXXX
54.It Fl i Ar interval
55Allows for the broadcast interval to be changed from the default 3 minutes.
56The
57.Ar interval
58argument is the number of seconds to change the interval to, or if the
59value is suffixed by
60.Dq m
61then it is interpreted as minutes.
62The maximum allowed value for the broadcast interval is 11 minutes
63because higher values will cause
64.Xr ruptime 1
65to mark the host as being down.
66.It Fl u Ar user
67Drop privileges and become the user
68.Ar user .
69.El
70.Pp
71.Nm
72operates as both a producer and consumer of status information.
73As a producer of information it periodically
74queries the state of the system and constructs
75status messages which are broadcast on a network.
76As a consumer of information, it listens for other
77.Nm
78servers' status messages, validating them, then recording
79them in a collection of files located in the directory
80.Pa /var/rwho .
81.Pp
82The server transmits and receives messages at the port indicated
83in the
84.Dq who
85service specification; see
86.Xr services 5 .
87The messages sent and received, are of the form:
88.Bd -literal -offset indent
89struct	outmp {
90	char	out_line[8];		/* tty name */
91	char	out_name[8];		/* user id */
92	int32_t	out_time;		/* time on */
93};
94
95struct	whod {
96	char	wd_vers;
97	char	wd_type;
98	char	wd_fill[2];
99	int32_t	wd_sendtime;
100	int32_t	wd_recvtime;
101	char	wd_hostname[32];
102	int32_t	wd_loadav[3];
103	int32_t	wd_boottime;
104	struct	whoent {
105		struct	outmp we_utmp;
106		int32_t	we_idle;
107	} wd_we[1024 / sizeof (struct whoent)];
108};
109.Ed
110.Pp
111All fields are converted to network byte order prior to
112transmission.
113The load averages are as calculated by the
114.Xr w 1
115program, and represent load averages over the 5, 10, and 15 minute
116intervals prior to a server's transmission; they are multiplied by 100
117for representation in an integer.
118The host name included is that returned by the
119.Xr gethostname 3
120function call, with any trailing domain name omitted.
121The array at the end of the message contains information about
122the users logged in to the sending machine.
123This information includes the contents of the
124.Xr utmp 5
125entry for each non-idle terminal line and a value indicating the
126time in seconds since a character was last received on the terminal line.
127.Pp
128Messages received by the
129.Xr rwho 1
130server are discarded unless they originated at an
131.Xr rwho 1
132server's port.
133In addition, if the host's name, as specified
134in the message, contains any unprintable
135.Tn ASCII
136characters, the message is discarded.
137Valid messages received by
138.Nm
139are placed in files named
140.Pa whod.hostname
141in the directory
142.Pa /var/rwho .
143These files contain only the most recent message, in the
144format described above.
145.Pp
146Status messages are generated by default approximately once every
1473 minutes.
148.Sh SEE ALSO
149.Xr ruptime 1 ,
150.Xr rwho 1
151.Sh HISTORY
152The
153.Nm
154command appeared in
155.Bx 4.2 .
156.Sh BUGS
157There should be a way to relay status information between networks.
158Status information should be sent only upon request rather than continuously.
159People often interpret the server dying or network communication
160failures as a machine going down.
161