Introduction:
When using the USB connections for serial access, with a quad UART only a few ports are used. It is a good idea to remove extra ports defined so that extra licenses can be freed. For the quad UART 4 licenses are used when it is connected, however removing these unused defined ports will release the licenses.
Steps:
When the device is booting up, the extra ports can be removed so the licenses are freed for other use. These are Managed Device (Access) licenses that allows to add more Managed Devices.
1. Login into root shell. after in the CLI "shell sudo su -" can be used to go into the root shell
2. Add the script the remove_usb.sh into "/etc/scripts/auditing" folder
- #!/bin/bash
- # Runs on Startup Event 101
- # This script runs and remove all the USB port 3 and 4 on the Quad UART
- #
- # Get all the Access devices
- outFile=/tmp/test.txt
- cliFile=/tmp/cliFile.cli
- cliCmdStr="cli show /access/"
- su admin - -c "$cliCmdStr" > $outFile
- echo "cd /settings/devices/" > $cliFile
- # Get all the USB Devices that have sub port 3 and 4
- matchPattern='usbS[0-9]-[0-9]+-[3-4]'
- while IFS= read -r line
- do
- if [[ "$line" =~ $matchPattern ]]; then
- echo "delete $BASH_REMATCH" >> $cliFile;
- echo "yes" >> $cliFile
- fi
- done < $outFile
- echo "commit" >> $cliFile
- sudo su - admin -c "cli -f $cliFile"
- rm $outFile
- rm $cliFile
- exit 0
3. change the file mode into an executable with "chmod +x remove_usb.sh"
4. In the NGM Web UI. Choose "Auditing::Events::Event List and select Event 101 (Nodegrid System Started)
5. in the "Action Script" choose the remove_usb.sh. This allows the script to run every time the Nodegrid boots up
Results:
All the USBS#-#-3 or 4 will be removed from the Managed Device hence, the licenses will be freed.