35dbb6b
#!/bin/bash
35dbb6b
# Copyright 2008 Tom "spot" Callaway <tcallawa@redhat.com>
35dbb6b
# Permission to use, copy, modify, distribute, and sell this software and its
35dbb6b
# documentation for any purpose is hereby granted without fee, provided that
35dbb6b
# the above copyright notice appear in all copies and that both that
35dbb6b
# copyright notice and this permission notice appear in supporting
35dbb6b
# documentation.  No representations are made about the suitability of this
35dbb6b
# software for any purpose.  It is provided "as is" without express or
35dbb6b
# implied warranty.
35dbb6b
# 
35dbb6b
# Ensure that xmms2d is running before the client.
35dbb6b
35dbb6b
PIDFILE=/var/tmp/xmms2d
35dbb6b
ARGS=1
35dbb6b
35dbb6b
if [ $# -ne "$ARGS" ]; then
35dbb6b
   echo "Usage: `basename $0` xmms2-client"
35dbb6b
   exit 65
35dbb6b
fi
35dbb6b
35dbb6b
if [ -f $PIDFILE ]; then
35dbb6b
   # Okay, we found the pidfile
35dbb6b
   XMMS2PID=`cat $PIDFILE`
35dbb6b
   XMMS2DINPS=`ps $XMMS2PID |grep xmms2d`
35dbb6b
   if [ -z "$XMMS2DINPS" ]; then
35dbb6b
	xmms2-launcher -P $PIDFILE &> /dev/null
35dbb6b
   fi
35dbb6b
else
35dbb6b
   # Okay, so the pid file isn't there. Launch xmms2d anyway.
35dbb6b
   xmms2-launcher -P $PIDFILE &> /dev/null
35dbb6b
fi
35dbb6b
35dbb6b
$1