PDA

View Full Version : help for a simple BEEP MEDIA PLAYER script


ashrack
March 2nd, 2006, 10:13 AM
I would like to have a script that would first check if BEEP MEDIA PLAYER is running and if it is it would lunch the following:
beep-media-player -s
but if BEEP MEDIA PLAYER isn't running than the script should just exit.
How could I accomplish this?

colo
March 2nd, 2006, 06:36 PM
#!/bin/bash
pgrep beep-media-play || beep-media-player -s

There's an option for bmp to disallow multiple instances of the program, though.

ashrack
March 6th, 2006, 09:47 AM
Your line does the opposite of what I want. It does this:
if BMP is started than it does nothing.
if BMP isn't started then it will do 'beep-media-player -s'

ashrack
March 6th, 2006, 10:44 AM
this script works:
result=`ps -A | grep beep-media-player`
if [ "$result" == "" ]
then
exit
else
beep-media-player -s
fi

colo
March 6th, 2006, 06:25 PM
Ah well, sorry - stupid me ;)

Change it to
#!/bin/bash
pgrep beep-media-play && beep-media-player -s
and you're done.

ashrack
March 7th, 2006, 03:52 AM
I knew there that had to be D error:
|| = or
&& = and

will try the new script. should work