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