Re: another scripting question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am Montag, 18. Februar 2008 17:54:33 schrieb Dave Phillips:
> Greetings,
>
> I'd like to add some conditional tests to my simple scripts. For
> example, I want to query the system to determine whether JACK is already
> running. If it is, I'll run an app (e.g. xine or AlsaPlayer) configured
> for JACK. If JACK is not running, I'll run the app without it.
>
> So how do I test for JACK in a simple bash shell script ?

hi

that is what I do:
#!/bin/bash 
if ps xa | grep -v grep | grep "jackd " >/dev/null ; then
    if ! ps xa | grep -v grep | grep "qjackctl" >/dev/null ; then
      pidjackd=`pidof jackd`
      kill -TERM "$pidjackd"
      sleep 1
      qjackctl &>/dev/null & 
      sleep 1
    fi
else
    if ps xa | grep -v grep | grep "qjackctl" >/dev/null ; then
      pidqjack=`pidof qjackctl`
      kill -TERM "$pidqjack"
      sleep 1
      qjackctl &>/dev/null &  
      sleep 1
    else
      qjackctl &>/dev/null & 
     sleep 1
   fi
fi
# this part check if jackd is start prop
cekz=0
cek=`pidof jackd`
while [ "$cek" = "" -a $cekz -lt 4 ]; do
  if    [ "$cek" = "" ]; then
     cekz=`expr $cekz + 1`
    sleep 2
    cek=`pidof jackd`
  fi
done
# this part start applications if jackd run
if    [ "$1" != "" -a $cekz -lt 5 ]; then
while [ "$1" != "" ]; do
      $1 &>/dev/null  &
#     sleep 5   # if apps start to fast uncoment this
      shift
done
fi

with this script I start all my Audio/Midi apps. I have add it to the 
menuentry`s like that: /path/to/script rosegarden qsynth vkeybd
or
/path/to/script ardour qjacktuner


reegards   hermann
_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@xxxxxxxxxxxxxxxxxxxx
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-user

[Index of Archives]     [Linux Sound]     [ALSA Users]     [Pulse Audio]     [ALSA Devel]     [Sox Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux