2010-mplayer-daemon/mplayerd
2010-09-25 23:54:49 +02:00

22 lines
454 B
Bash
Executable File

#!/bin/bash
source "$(dirname "$0")/config"
if [ "$1" == "stop" ]; then
if [ -e /dev/shm/mplayer-pid ]; then
if ! kill "$(<"$MP_PID")"; then
echo "Failed to kill mplayer."
exit 2
fi
else
echo "Can't find $MP_PID ."
exit 3
fi
else
[ -p "$MP_CONTROL" ] || mkfifo "$MP_CONTROL"
[ -p "$MP_OUTPUT" ] || mkfifo "$MP_OUTPUT"
mplayer -quiet -slave -input file="$MP_CONTROL" -idle > "$MP_OUTPUT" 2> "$MP_ERROR" &
echo "$!" > "$MP_PID"
fi