Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision |
Your text |
Line 64: |
Line 64: |
| * You should be able to see the printer attached to the usb port | | * 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]] | | [[Category:HOWTO]] |