I am trying to create a .bat file for Linux that:
- Checks for an existing instance of an application, then
- Launches an initial instance of the app or calls the existing instance forward.
I currently have a .bat (below) that works on one Linux machine, but it will not work on other machines.
#!/bin/bash
pid=`ps axwww | grep filename | grep java | sed -e 's/^[ \t]*//' | cut -f1 -d " "`
if [ a$pid == "a" ]
then
java -Djava.net.preferIPv4Stack=true -Dsun.java2d.opengl=true -jar filename.jar /home/user/Desktop/folder/config/FILENAMEConfig.properties
else
wid=`xdotool search "FILENAME"`
xdotool windowactivate $wid
fi
My issue is that when I copy this .bat to another machine, it gives me the error:
Defaulting to search window name, class, and classname XGetWindowProperty[_NET_WM_DESKTOP] failed (code=1)
I have tried manually typing a new .bat on the second machine--still fails.
Any help is greatly appreciated.