[Gambas-user] need help Script to start program

Primorec igor.furlan at ...626...
Fri Nov 12 19:14:48 CET 2004


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

here is one way of doing it
`
TIMID=`ps -auxw | grep timidity | awk '{print $2}'
kill -9 $TIMID

On Thu, 11 Nov 2004 11:04:03 +0100, Ron Onstenk <ronstk at ...239...> wrote:
> [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
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by:
> Sybase ASE Linux Express Edition - download now for FREE
> LinuxWorld Reader's Choice Award Winner for best database on Linux.
> http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>




More information about the User mailing list