Deleting extra USB port for quad Uart

Deleting extra USB port for quad Uart

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
  1. #!/bin/bash
  2. # Runs on Startup Event 101
  3. # This script runs and remove all the USB port 3 and 4 on the Quad UART
  4. #
  5. # Get all the Access devices
  6. outFile=/tmp/test.txt
  7. cliFile=/tmp/cliFile.cli
  8. cliCmdStr="cli show /access/"
  9. su admin - -c "$cliCmdStr" > $outFile
  10. echo "cd /settings/devices/" > $cliFile
  11. # Get all the USB Devices that have sub port 3 and 4
  12. matchPattern='usbS[0-9]-[0-9]+-[3-4]'
  13. while IFS= read -r line
  14. do
  15.   if [[ "$line" =~ $matchPattern ]]; then
  16.           echo "delete $BASH_REMATCH" >> $cliFile;
  17.           echo "yes" >> $cliFile
  18.   fi
  19. done < $outFile
  20. echo "commit" >> $cliFile
  21. sudo su - admin -c "cli -f $cliFile"
  22. rm $outFile
  23. rm $cliFile
  24. 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.