SPY
HILL
Research
|
Spy-Hill.com
|
| Poughkeepsie, New York | [DIR] [UP] |
How to get the Unix rwhod service to start at boot time on a Mac; and how to use the commands to get information from it.
Last updated: 2 October 2009
|
The rwhod daemon is a Unix service which monitors the status of other machines on the local network, and provides this information to the local client programs rwho and ruptime.
Mac OS X includes the rwhod daemon and the user commands, but it does not come configured so that the daemon starts at boot time. The instructions
StartupParameters.plist contains:
{
Description = "rwho/ruptime system";
Provides = ("rwhod");
Requires = ("Resolver");
OrderPreference = "None";
Messages =
{
start = "Starting rwho daemon";
stop = "Stopping rwho daemon";
};
}
rwhod contains:
#!/bin/sh # # Start the rwhod at system startup time on MacOSX # # Eric Myers- 23 July 2003 # @(#) $Id:$ ###################################################################### . /etc/rc.common # Add 'status' option RunService () { case $1 in start ) StartService ;; stop ) StopService ;; restart) RestartService ;; status ) StatusReport ;; * ) echo "$0: unknown argument: $1";; esac } StatusReport () { PID=`ps ax | grep -v grep | awk '$5 ~ /\/rwhod$/ {print $1}'` if [ "$PID" != "" ]; then echo "rwhod (pid $PID) is running... " exit 0 else if [ -f /var/run/rwhod.pid ]; then echo "rwhod is stopped but pid file exists." exit 1 else echo "rwhod is stopped " exit 2 fi fi } StartService () { CheckForNetwork if [ "${NETWORKUP}" = "-NO-" ]; then exit; fi if [ ! -x /usr/sbin/rwhod ]; then exit; fi ConsoleMessage "Starting rwho daemon" /usr/sbin/rwhod # Create pid file PID=`ps ax | grep -v grep | awk '$5 ~ /rwhod/ {print $1} '` echo $PID > /var/run/rwhod.pid } StopService () { PID=`ps ax | grep -v grep | awk '$5 ~ /\/rwhod$/ {print $1}'` if [ "$PID" != "" ]; then ConsoleMessage "Stopping rwho daemon" kill -TERM "${PID}" rm -f /var/run/rwhod.pid else echo "rwhod is not running." fi } RestartService () { StopService StartService } RunService "$1" ##
| Last modified: Friday October 02, 2009 | Copyright © 2009 by Spy Hill Research | http://www.spy-hill.com /~myers/help/apple/rwhod.html |