[Gambas-user] need help Script to start program

Ron Onstenk ronstk at ...239...
Thu Nov 11 11:04:03 CET 2004


[off-gambas]

I have a simple problem

I have made a script but I'm doing something wrong.
I know RTFM but which and where to search for, I've bad luck
with bash scripts every time, sorry

 
#!/bin/sh
# i want to run next line
# timidity.sh /data3/media/audio/midi/gus2/SOFUNKY.MID
# it has to kill running instance(s) before new one start 
# it needs a audio output and is blocked if not killed.
#
# The script is a stub between the *.mid file assoc and the
# program to use it as argument.

# how to get safe the PID to kill ???
#TIMID=`ps -ax |grep timidity`
#echo "proc=${RUN}"
TIMID=timidity

NFIL=$1 # the argument from the command
NFIL=/data3/media/audio/midi/gus2/SOFUNKY.MID

# get the running file 
OFIL=`cat /var/tim.lock`

#kill running timidity
kill -TERM ${TIMID} #here it can't find ???

if [ -f /var/tim.lock ] ; then
  echo "exit player for ${OFIL}"
  unlink /var/tim.lock
fi

echo ${NFIL} > /var/tim.lock
echo "playing now ${NFIL}"

# run program with new argument
# should it exit or stay running
# till process is done?
timidity ${NFIL} & # <-- do I need the & at the end?

[/offgambas]

I assume it is not difficult but as told, I have bad luck.
I want to play midi files and it should not block until ready.
If I select an other midi file it must abort the playing one 
and start to play the new selected one.

Ron




More information about the User mailing list