I want to create a Linux Service to monitor if the Vision Client is running or not. I do not know whether there is an internal socket or something I could use to "listen" or monitor whether the Vision Client is running.
Can anyone help me with this issue?
Thanks in advance.
No, there's nothing to listen for. But java will show in the process list, and you can examine the process properties in the /proc/ filesystem to confirm what it is.
Well, perhaps you have a HMI running and you want to make sure that the Vision Client is always up. If you wanted for example cron job that checks the status and starts a client if none is running....
Instead of looking through all the processes, you could try using the 'Java Virtual Machine Process Status', provided you're running OpenJDK, with the command 'jps'
However - while I can get crontab to check the status of a running client (see below), I cannot for the life of me launch a Vision client with crontab. The script below works when ran from the command line, but crontab fails to open the Vision client. I changed permissions on the folders and files (chmod 777) but still no luck. It seems the native launcher just can't be launched by crontab...?? Even running under sudo crontab - no luck.
#!/bin/bash
if [ ! -z "$(jps -v | grep ClientLaunchHook)" ]; then
echo "Vision client is running."
else
cd "/home/myuser/Downloads/clientlauncher" && "./clientlauncher.sh" scope=C project=Edge gateway.addr=127.0.1.1:8088:8043 windowmode=window useBundledJre=true
echo "Vision client is NOT running, trying to restart."
fi