I have a bunch of raspberry pis running clients (one client per station). I have a shell file that is called on startup/reboot to execute the bash script in the client icon so the client automatically opens. I have found a problem with this, and I am not sure if it is a RPi thing, or an Ignition thing.
If the shell script with the client start bash command is called without a network connection, it retries several times. Once the network is connected the raspberry pi will now have 5 clients or more open on top of each other. The RPis are on ethernet not wifi, so when I say no network connection, I mean the network servers are down. Everything works fine when the network connection is good on startup.
I had a situation where this happened due to a waterline breakage. Instead of the normal ~56 clients, I had 198 open!
Hi @dkhayes117,
It’s hard to know without more information (for example, the script). One suggestion that comes to mind is pinging the gateway before launching a client
@jcoffman
#!/bin/sh
sleep 10
bash -c 'cd "/home/pi/Downloads/clientlauncher" && "./clientlauncher.sh" scope=C project=SewingStation gateway.addr=xx.xx.x.xxx:8088:8043 windowmode=fullscreen useBundledJre=false'
I will look into pinging the gateway before executing the script
Edit
This shell script is called by the pi’s autostart file: /home/pi/etc/xdg/lxsession/LXDE-pi/autostart
using @/home/pi/autostartClient.sh
I just tried opening the client manually by double clicking on the shortcut icon with no network connection. I let it sit for about 2-3 minutes, then connected the ethernet. Once it finally opened the client, there was only one instance. It seems to be a raspberry pi issue as the bash script in my shell file and the bash script in the shortcut icon are the same. It must be failing then calling the autostartClient.sh file over and over.
1 Like
After spending several hours on this, it finally dawned on me why this is happening. I have another command in my shell script that mounts a network drive. Without a network connection, this command fails and causes the pi to retry the script 6 times before giving up. Removing this mounting command causes the Ignition client command to open only one client regardless of network connectivity. Live and learn I guess…
Anyways I wrote a new shell script to check for network connectivity, so I thought I would share it
#!/bin/sh
sleep 10 # allow time for network connection to be established if possible
status=$(cat /sys/class/net/eth0/carrier) # check for good ethernet connection
until [ $status = 1 ]
do
echo "waiting for network connection..."
sleep 10
status=$(cat /sys/class/net/eth0/carrier) # Check status every 10 seconds
done
echo "network is connected"
sleep 10 # allow time for connection to be established
bash -c 'cd "/home/pi/Downloads/clientlauncher" && "./clientlauncher.sh" scope=C project=SewingStation gateway.addr=xx.xx.x.xxx:800:8043 windowmode=fullscreen useBundledJre=false'