Dans /etc/init.d/stop-usb-power
#! /bin/sh
### BEGIN INIT INFO
# Provides: stop-usb-power
# Required-Start:
# Required-Stop:
# Should-Stop:
# Default-Start:
# Default-Stop: 0 6
# Short-Description: Unload all usb modules in order to poweroff usb devices.
### END INIT INFO
PATH=/sbin:/bin
. /lib/init/vars.sh
. /lib/lsb/init-functions
do_stop () {
[ "$VERBOSE" = no ] || log_action_begin_msg "Unloading USB modules"
for mod in hid usbcore ohci_hcd ehci_hcd usbhid; do
modprobe -r $mod
done
}
case "$1" in
start)
# No-op
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
do_stop
;;
*)
echo "Usage: $0 start|stop" >&2
exit 3
;;
esac
:
Puis :
sudo chmod +x /etc/init.d/stop-usb-power
sudo update-rc.d stop-usb-power stop 39 0 6 .