Hello
I have a problem writing a shell script, that is supposed to run as a demon. Its aim is to check for a device file and then to execute another script, that is, it checks, if the exaile music player creates a jack device, then it executes the script for establishing jack connections exaile->jamin.
It looks like this:
Code:
#!/bin/sh
while true
do
if [ -f /dev/shm/sem.jack_sem.1000_default_exaile.py ]
then
/usr/local/bin/jack_snapshot restore 2
break
else
continue
fi
done
As you can see, I have applied an endless loop, in order to work constantly in the background. The problem is, that I want the "/usr/local/bin/jack_snapshot restore 2" to be executed only once. The script is supposed to do the following:
Check if the device "/dev/shm/sem.jack_sem.1000_default_exaile.py" is present, then create the jack connections. If exaile isn't playing, the device file is not present. Anyone has an idea, how to accomplish this?