Open main menu

OpenVZ Virtuozzo Containers Wiki β

Changes

USB Printing in VE

854 bytes added, 16:51, 17 April 2012
no edit summary
* You should be able to see the printer attached to the usb port
== Sample bash shell script for compute vzctl command for dynamically assigning some devices to one VZ ==
Be care, the command <code>vzctl set xxx --devices "dddd" --devnodes "nnnn" --save</code> will reassign
the entire list of devices shared to one VZ, even suppressing some already presents.
<code>
#!/bin/bash
VZ=1234
DEVICES="[bB]luetooth|[pP]rinter"
VZDEV=""
VZNOD=""
while read A B C D E;do
if [[ "$E" =~ (${DEVICES}) ]] ;then
BUS=${B#0} DEV=${D%:}
BUS=${B#0} DEV=${DEV#0}
DEV=${DEV#0}
VZDEV="$VZDEV c:189:$(((BUS-1)*128+DEV-1)):rw"
VZNOD="$VZNOD bus/usb/$B/${D}rw"
fi
done < <(lsusb)
printf "DEVICES=\"%s\"\n" "${VZDEV# }"
printf "DEVNODES=\"%s\"\n" "${VZNOD# }"
printf "vzctl set %d --devices '%s' --devnodes '%s' --save\n" $VZ "${VZDEV# }" "${VZNOD# }"
</code>
[[Category:HOWTO]]
Anonymous user