I've written the following script, intended to start a daemon and display a Zenity window, then stop the daemon when the window is closed:
#!/usr/bin/fish if not ps aux | grep [s]erviio > /dev/null set -x JAVA "/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java" ~/Programs/serviio/bin/serviio.sh & zenity --info --text="Serviio is running.\nClick OK to stop." --title="Serviio" ~/Programs/serviio/bin/serviio.sh -stop end
If I run the script from a terminal it works just fine. It also works from a bash terminal, which seems to show that the shebang is working as expected.
However if I create a launcher to point to the script and try to run it, nothing happens. Serviio doesn't start (I can confirm that from
ps aux) and no Zenity window shows.
I've tried to figure out what it is about the script that's causing a problem but haven't had any success.
- If I remove the test for whether Serviio is running, the script works.
- If I keep the check but make the script display the contents of $JAVA in a Zenity window instead of launching Serviio, it works.
In other words I can't identify any single element in the script that would prevent it from running.
What could be the problem?