|HOTPLUGD(8)||System Manager's Manual||HOTPLUGD(8)|
hotplugddaemon monitors the hotplug(4) pseudo-device, acting on signaled events by executing the scripts in the /etc/hotplug directory. By default it uses the /dev/hotplug device for reading events from, but an alternative device can be specified with the
Actions can be configured either for device attachment or
detachment. On device attachment the attach script
is executed if it exists. On device detachment the
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. The device class corresponds to the classes
described in the
<sys/device.h> header file
and can be one of the following:
Not all classes are really usable. For example, it's unlikely that a CPU will be hotplugged.
The device name is the usual name, as listed in MAKEDEV(8), and the unit number, e.g. sd1.
#!/bin/sh DEVCLASS=$1 DEVNAME=$2 case $DEVCLASS in 2) # disk devices disklabel=`/sbin/disklabel $DEVNAME 2>&1 | \ sed -n '/^label: /s/^label: //p'` case $disklabel in Sony*DSC*) # Sony DSC camera mount -o nodev,nosuid /dev/"$DEVNAME"i /mnt/camera ;; esac ;; 3) # network devices; requires hostname.$DEVNAME sh /etc/netstart $DEVNAME ;; esac
hotplugdprogram first appeared in OpenBSD 3.6.
hotplugdprogram was written by Alexander Yurchenko <firstname.lastname@example.org>.
|July 27, 2015||OpenBSD-6.1|