#!/bin/sh
#
# ========================================================================
#
# *
# * This file is part of MARS, the MAGIC Analysis and Reconstruction
# * Software. It is distributed to you in the hope that it can be a useful
# * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
# * It is distributed WITHOUT ANY WARRANTY.
# *
# * Permission to use, copy, modify and distribute this software and its
# * documentation for any purpose is hereby granted without fee,
# * provided that the above copyright notice appear in all copies and
# * that both that copyright notice and this permission notice appear
# * in supporting documentation. It is provided "as is" without express
# * or implied warranty.
# *
#
#
#   Author(s): Daniela Dorner  05/2007 <mailto:dorner@astro.uni-wuerzburg.de>
#
#   Copyright: MAGIC Software Development, 2000-2007
#
#
# ========================================================================
#
# This script checks, if another script - given by command line option - 
# is running. 
#

source `dirname $0`/sourcefile
#printprocesslog "INFO starting $0"

if ! [ "$2" = "" ]
then
   printprocesslog "WARN two many command line options given in $@ -> exit"
   finish >/dev/null
fi

path=`dirname $0`
script="/bin/sh "$path/$1
if ! ps -o "%a" -C '$1' | grep -x "$script" >/dev/null
then 
   printprocesslog "INFO starting $script"
   $script &
fi 

#printprocesslog "INFO finished $0"

