#!/usr/bin/perl
system('mplayer -msglevel all=1 -zoom -quiet -idle -input file=$HOME/.playd.fifo');
SirDice said:Simplest way to do it:
Code:#!/usr/bin/perl system('mplayer -msglevel all=1 -zoom -quiet -idle -input file=$HOME/.playd.fifo');
A more complicated way to do it would be to use fork().
http://hell.jedicoder.net/?p=82
MPLAYER_CMD = "mplayer -msglevel all=1 -zoom -quiet -idle -input file=$HOME/.playd.fifo"
....
playd_start() {
playd_check # check if mplayer is running in slave mode
if [ "$?" -eq 0 ]; then # mplayer is not running
if [ "$1" = 'nobg' ]; then
exec $UTERM -geometry ${CONSOLE_GEOMETRY} -e ${MPLAYER_CMD} #run terminal and mplayer
echo "$!" > "$HOME/.playd.lock" #save pid to file1
#echo 'playd started'
else
exec ${MPLAYER_CMD} >> /dev/null & #run mplayer
echo "$!" > "$HOME/.playd.lock" #save pid to file1
#echo 'playd started'
fi
else # mplayer is running
if [ ! "$2" = 'silent' ]; then
echo 'playd seam to be running'
echo 'if not, try:'
echo " $(basename $0) restart"
fi
fi
}
http://search.cpan.org/~nwclark/per...od#Complete_Dissociation_of_Child_from_Parentkillasmurf86 said:I want my perl script to fork mplayer, get it's pid, write to file, and continue to work like nothing happen![]()
SirDice said: