diff options
author | Alexander Yurchenko <grange@cvs.openbsd.org> | 2004-05-30 08:28:29 +0000 |
---|---|---|
committer | Alexander Yurchenko <grange@cvs.openbsd.org> | 2004-05-30 08:28:29 +0000 |
commit | 0cfc09514721fd5490d1b579e2233213321491cb (patch) | |
tree | 44be8fde070b50437ad2d3eb81067c2518285981 /usr.sbin/hotplugd/hotplugd.8 | |
parent | 148660ad683d28da2bdb330138d50e5363c3bedb (diff) |
hotplugd -- devices hot plugging monitor daemon.
The hotplugd daemon monitors the hotplug(4) pseudo-device, acting on
signaled events by executing the scripts in the /etc/hotplug directory.
Not linked to the build yet.
Diffstat (limited to 'usr.sbin/hotplugd/hotplugd.8')
-rw-r--r-- | usr.sbin/hotplugd/hotplugd.8 | 126 |
1 files changed, 126 insertions, 0 deletions
diff --git a/usr.sbin/hotplugd/hotplugd.8 b/usr.sbin/hotplugd/hotplugd.8 new file mode 100644 index 00000000000..fd400566bdc --- /dev/null +++ b/usr.sbin/hotplugd/hotplugd.8 @@ -0,0 +1,126 @@ +.\" $OpenBSD: hotplugd.8,v 1.1 2004/05/30 08:28:28 grange Exp $ +.\" +.\" Copyright (c) 2004 Alexander Yurchenko <grange@openbsd.org> +.\" +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.\" +.Dd March 30, 2004 +.Dt HOTPLUGD 8 +.Os +.Sh NAME +.Nm hotplugd +.Nd devices hot plugging monitor daemon +.Sh SYNOPSIS +.Nm hotplugd +.Op Fl d Ar device +.Sh DESCRIPTION +The +.Nm +daemon monitors the +.Xr hotplug 4 +pseudo-device, acting on signaled events by executing the scripts in the +.Pa /etc/hotplug +directory. +By default it uses the +.Pa /dev/hotplug +device for reading events from, but an alternative device can be +specified with the +.Fl d +option. +Actions can be configured either for device attachment or detachment. +On device attachment the +.Pa attach +script is executed if it exists. +On device detachment the +.Pa detach +script is executed if it exists. +In both cases two parameters are passed to the scripts: the class and name +of the attached or detached device. +Device class corresponds to the classes described in the +.Aq Pa sys/device.h +header file and can be one of the following: +.Bl -tag -width Ds +.It 0 +generic, no special info +.It 1 +CPU (carries resource utilization) +.It 2 +disk drive +.It 3 +network interface +.It 4 +tape device +.It 5 +serial line interface +.El +.Pp +Not all classes can be really usable, e.g. it's unlikely to have +a hot plug CPU. +.Pp +Device name is a usual name including unit number, e.g.\& +.Pa sd1 . +.Sh FILES +.Bl -tag -width "/dev/hotplug/attach" -compact +.It /dev/hotplug +Pseudo-device file. +.It /etc/hotplug +Directory where the scripts to execute are located. +.It /etc/hotplug/attach +Script to execute on device attachment. +.It /etc/hotplug/detach +Script to execute on device detachment. +.El +.Sh EXAMPLES +Sample +.Pa attach +script: +.Bd -literal -offset indent +#!/bin/sh + +DEVCLASS=$1 +DEVNAME=$2 + +case $DEVCLASS in +2) + # disk devices + + disklabel=`/sbin/disklabel $DEVNAME | grep '^label:' | \e + sed -e 's/^label: //'` + case $disklabel in + Sony*DSC*) + # Sony DSC camera + mount /dev/"$DEVNAME"i /mnt/camera + ;; + esac + + ;; +3) + # network devices + + /sbin/dhclient $DEVNAME + + ;; +esac +.Ed +.Sh SEE ALSO +.Xr hotplug 4 +.Sh HISTORY +The +.Nm +program first appeared in +.Ox 3.6 . +.Sh AUTHORS +The +.Nm +program was written by +.An Alexander Yurchenko Aq grange@openbsd.org . |