portserver: reconfigure from command line

The default tool is based on tcl and requires a Display connection on Linux (Centos 7.5).

Due to problems with the portserver configuration disappearing if the portserver fails to start before the Linux box a solution is required that can be scripted.

The following script is my first pass attempt at this (appears to work -  update the IP address):

#!/bin/bash 
for i in {0..10..1}
do
    if [ ! -f /dev/tty103 ]; then
        echo "Device not found. Attempting to create!"
        pushd /usr/bin/dgrp/config
        ./dgrp_cfg_node -v -m 0666 init 1 192.168.XX.YY 4
        if [ -f /dev/tty103 ]; then
            chmod gou+rw /dev/tty_dgrp*
            /etc/init.d/dgrp_daemon restart
            chkconfig dgrp_daemon on
            chkconfig dgrp_ditty on
            break
        else
            echo "Device not created!"
            sleep 5
        fi
        popd
    else
        echo "Device exists!"
        break 
    fi
done


The device(s) are mapped starting at '/dev/tty100' on my system. 
I am using static IP address for the portserver at 192.168.XX.YY (update as required).
The device has 4 serial ports.
The device ID is set to 1.
Ideally the above script should run before any program that needs to use the portserver just to check the device driver is setup. This is the part I've not tested yet...

Comments