Index: trunk/Mars/datacenter/scripts/jobmanager
===================================================================
--- trunk/Mars/datacenter/scripts/jobmanager	(revision 9940)
+++ trunk/Mars/datacenter/scripts/jobmanager	(revision 10004)
@@ -20,5 +20,5 @@
 #   Author(s): Daniela Dorner  05/2006 <mailto:dorner@astro.uni-wuerzburg.de>
 #
-#   Copyright: MAGIC Software Development, 2000-2009
+#   Copyright: MAGIC Software Development, 2000-2010
 #
 #
@@ -26,5 +26,5 @@
 #
 # This a script, which launches other scripts (all scripts, that are run 
-# on primary basis
+# on primary basis)
 #
 
@@ -57,4 +57,9 @@
             # FIXME: get complete scriptname (including command line option), needed for runstereo
             alias 'checkqueue'="/opt/gridengine/bin/lx26-amd64/qstat \`echo \$noderequirementstat\`  | awk ' { print \"Owner\"\$4\" \" \$3\"Jobstatus\"\$5 } '"
+            break
+            ;;
+      pbs)  echo " on queuing system 'pbs'" >> $jmscriptlog 2>&1
+            alias 'queuesubmit'='$pbspath/qsub -l walltime=$walltime -l pmem=$pmem -v AUTOMATIONSETUP=$AUTOMATIONSETUP,SOURCEFILEPATH=$SOURCEFILEPATH -e `echo $runlogpath`/error-`echo $date`.log -o `echo $runlogpath`/log-`echo $date`.log `echo $noderequirementsub` `echo $scriptspath`/`echo ${scripts[$i]}` '
+            alias 'checkqueue'="$pbspath/qstat -a | awk ' { print \"Owner\"\$2\" \" \$4\"Jobstatus\"\$10 } '"
             break
             ;;
@@ -90,4 +95,17 @@
       step=${scriptscolname[$i]}
       getstepinfo
+      # check if walltime has to be set
+      if [ "$setwalltime" = "yes" ]
+      then
+         walltime=${walltimes[$i]}
+      fi
+      # check if memory has to be set
+      if [ "$setpmem" = "yes" ]
+      then
+         pmem=${pmems[$i]}
+      fi
+      # check if the script is restricted to one node 
+      #   (i.e. where output of previous step(s) is stored)
+      # this information is taken from the steps.rc file
       if [ "$noderestricted" = "yes" ]
       then
@@ -163,5 +181,8 @@
       queuedscript=${#q2[@]}
       # get running scripts
-      q3=( `echo ${q[@]} | egrep -o \("${scripts[$i]}"Jobstatus2\|"${scripts[$i]}"Jobstatusr\)` )
+      #   condor: 2
+      #   sge: r
+      #   pbs: R
+      q3=( `echo ${q[@]} | egrep -o \("${scripts[$i]}"Jobstatus2\|"${scripts[$i]}"Jobstatusr\|"${scripts[$i]}"JobstatusR\)` )
       runningscript=${#q3[@]}
       stillinqueue=`echo $queuedscript - $runningscript | bc `
Index: trunk/Mars/datacenter/scripts/runcorsika
===================================================================
--- trunk/Mars/datacenter/scripts/runcorsika	(revision 9940)
+++ trunk/Mars/datacenter/scripts/runcorsika	(revision 10004)
@@ -28,5 +28,10 @@
 # 
 
-source `dirname $0`/sourcefile
+if [ "$SOURCEFILEPATH" = "" ]
+then 
+   source `dirname $0`/sourcefile
+else
+   source $SOURCEFILEPATH/sourcefile
+fi
 printprocesslog "INFO starting $0"
 program=corsika
Index: trunk/Mars/datacenter/scripts/setup.phido.fact.mc
===================================================================
--- trunk/Mars/datacenter/scripts/setup.phido.fact.mc	(revision 10004)
+++ trunk/Mars/datacenter/scripts/setup.phido.fact.mc	(revision 10004)
@@ -0,0 +1,122 @@
+#!/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  09/2010 <mailto:daniela.dorner@unige.ch>
+#
+#   Copyright: MAGIC Software Development, 2000-2010
+#
+#
+# ========================================================================
+#
+# This a resource file for the scripts, in which the standard paths and 
+# functions, which are needed more often are stored. 
+#
+
+rootsys=/fhgfs/groups/app/magic/software/root_v5.12.00g
+if ! export | grep $rootsys  >|/dev/null
+then
+   export ROOTSYS=$rootsys
+   export PATH=$PATH:$ROOTSYS/bin
+   export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ROOTSYS/lib
+fi
+
+# queuing system
+queuesys=pbs # wuerzburg data center
+pbspath=/cm/shared/apps/torque/2.3.7/bin
+setwalltime="yes"
+setpmem="yes"
+
+
+mainpath=/fhgfs/groups/app
+
+# logging and setup
+logpath=$mainpath/fact/datacenter/autologs
+lockpath=$mainpath/fact/datacenter/locks
+setuppath=$mainpath/fact/simulated/setup
+
+## paths of data
+#datapath=/magic/data
+#subsystempath=/magic/subsystemdata
+#sequpath=/magic/sequences
+#datasetpath=/magic/datasets
+
+## paths and setup for mc
+mcpath=$mainpath/fact/simulated
+mcsequpath=$mcpath/sequences
+corsikapath=$mainpath/magic/software/MagicSoft/Simulation/Corsika/Mmcs6500
+corsikapath=$mainpath/fact/Mmcs6500
+export FLUPRO=$corsikapath'/fluka2008_3c'
+
+
+#webpath=/www/htdocs/datacenter
+
+# get paths for mars, macros and scripts
+if [ "$SOURCEFILEPATH" = "" ]
+then 
+   mars=`dirname $0 | sed -e 's/\/datacenter\/scripts//'`
+else
+   mars=`echo $SOURCEFILEPATH | sed -e 's/\/datacenter\/scripts//'`
+fi
+macrospath=$mars/datacenter/macros
+scriptspath=$mars/datacenter/scripts
+# rcfiles
+# dependencies of steps
+steps=$mars/resources/steps_fact.rc
+# file with db information
+sqlrc=$mars/sql.rc
+
+
+#addresses to which the errors are sent
+erradrs="dorner@astro.uni-wuerzburg.de" 
+#addresses to which the changes are sent
+adrs="dorner@astro.uni-wuerzburg.de" 
+
+
+#setup for jobmanager
+sleeptime=60 #30
+sleeptimelimit=360 #360
+errorsleeptimedefault=60 #60
+max=200 #maximum number of processes for one script in case there are more than one and the others do not have anything to do
+totalmax=200 #maximum number of processes (total) overwrites pnototal(we) in case it is smaller
+
+#
+# FIXME: 
+# max anz an prozessen setzen
+# besser Verhaeltnis zwischen den Prozessen und das am besten noch 
+# automatisch anpassen 
+# evtl noch maximale anz an callistos setzen
+# 
+
+#hour:             0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17  18  19  20  21  22  23
+pnototal=(       200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 )
+pnototalwe=(     200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 )
+
+pnocorsika=(     200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 )
+pnocorsikawe=(   200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 )
+
+# set variables for jobmanager 
+scripts=( "runcorsika"  ) 
+scriptscolname=( "Corsika" ) 
+pnosweek=( ${pnocorsika[@]} ) 
+pnoswe=( ${pnocorsikawe[@]} ) 
+
+# settings for pbs
+walltimes=( "72:00:00" )
+pmems=( "1gb" ) 
+
Index: trunk/Mars/datacenter/scripts/sourcefile
===================================================================
--- trunk/Mars/datacenter/scripts/sourcefile	(revision 9940)
+++ trunk/Mars/datacenter/scripts/sourcefile	(revision 10004)
@@ -44,9 +44,14 @@
 fi
 
+if [ "$SOURCEFILEPATH" = "" ]
+then 
+   export SOURCEFILEPATH=`dirname $0`
+fi
+
 # possible solution for $0 problem: 
 # ${BASH_SOURCE[0]} 
 # but has to be checked and tested more carefully
 # should solve at least problem with login-shell and with source
-source `dirname $0`/setup.$AUTOMATIONSETUP
+source $SOURCEFILEPATH/setup.$AUTOMATIONSETUP
 
 datetime=`date +%F-%H-%M-%S`
