Index: /issm/trunk/cron/ice1_config
===================================================================
--- /issm/trunk/cron/ice1_config	(revision 1521)
+++ /issm/trunk/cron/ice1_config	(revision 1521)
@@ -0,0 +1,20 @@
+#ISSM directory
+ISSM_DIR="/u/wilkes-r1b/seroussi/svn/issm/trunk/cron/trunk"
+
+#ISSM Architecture
+ISSM_ARCH="macosx-gnu"
+
+#external pakages configs:
+EP_CONFIG="macosx"
+
+#number of cpus
+NUMCPUS=""
+
+#MATLAB path
+MATLAB_PATH="/usr/local/pkgs/matlab-7.6/"
+
+#execution path
+EXECUTION_PATH="/u/wilkes-r1b/morlighe/ExecutionNightlyRun"
+
+#packages to be run
+PACKAGES="{'macayeal','cielo_serial','cielo_parallel'}"
Index: /issm/trunk/cron/nightlyrun.sh
===================================================================
--- /issm/trunk/cron/nightlyrun.sh	(revision 1520)
+++ /issm/trunk/cron/nightlyrun.sh	(revision 1521)
@@ -3,39 +3,50 @@
 #It then processes the results and sends an email to the Ice developpers.
 
-#Recover package for which we run nightly.
-package=$1;
-echo $package
+#get configs
+if [ `hostname -s` == "wilkes" ]; then
+	source wilkes_config
+fi
+if [ `hostname -s` == "ice1" ]; then
+	source ice1_config
+fi
 
-#Some functions 
-function today_date {
-suffix=`date | awk '{printf("%s-%s-%s",$2,$3,$6);}'` 
-echo $suffix;
-}
-
-#Figure out today's date
-export today=`today_date`;
+#create nightly run variables
+export today=`date | awk '{printf("%s-%s-%s",$2,$3,$6);}'`;
 export host_name=`hostname`;
 
 #create ISSM variables
-export ISSM_DIR="/u/wilkes-r1b/morlighe/svn/issm/trunk/cron/trunk"
-export ISSM_ARCH=linux-gnu-amd64
-source $ISSM_DIR/etc/environment.sh
-export ISSM_RELEASE="issm";
+export ISSM_DIR
+export ISSM_ARCH
+export ISSM_RELEASE
 
-#Erase previous code
+#Erase previous code and Fetch the new one
 rm -rf trunk
-
-#Fetch svn code
 svn checkout http://s383-rhat/issm/svn/issm/trunk
 
-#Go to the issm directory
+#install ISSM
 cd $ISSM_DIR
-
-#install ISSM
 
 #1: modify some variables
 cd etc
-	cat environment_variables.sh | sed -e "s/C:\/MATLAB\/R2009a\//\/usr\/local\/pkgs\/matlab-7.6\//g" > environment_variables.sh.bak
+	#modify MATLAB_PATH ( /usr/...   ->   \/usr\/...)
+	echo $MATLAB_PATH | sed 's/\//\\\//g' > MATLAB_PATH2
+	MATLAB_PATH2=`cat MATLAB_PATH2`
+	rm MATLAB_PATH2
+
+	#modify MATLAB_DIR in environment_variables.sh
+	cat environment_variables.sh | sed -e "s/C:\/MATLAB\/R2009a\//$MATLAB_PATH2/g" > environment_variables.sh.bak
 	mv environment_variables.sh.bak environment_variables.sh
+
+	#modify EXECUTION_PATH ( /usr/...   ->   \/usr\/...)
+	echo $EXECUTION_PATH | sed 's/\//\\\//g' | sed 's/-/\\-/g' > EXECUTION_PATH2
+	EXECUTION_PATH2=`cat EXECUTION_PATH2`
+	rm EXECUTION_PATH2
+	echo $ISSM_DIR\/bin | sed 's/\//\\\//g' | sed 's/-/\\-/g' > CLUSTER_PATH
+	CLUSTER_PATH=`cat CLUSTER_PATH`
+	rm CLUSTER_PATH
+
+	#modify EXECUTION_PATH in cluster.rc
+	cat cluster.rc | sed -e "s-cluster_codepath.*-cluster_codepath\=$CLUSTER_PATH-" | sed -e "s-cluster_executionpath.*-cluster_executionpath\=$EXECUTION_PATH2-" > cluster.bak
+	mv cluster.bak cluster.rc
 cd ..
 source $ISSM_DIR/etc/environment.sh
@@ -43,16 +54,16 @@
 #2: install some required external packages
 cd externalpackages
-cd mpich2
-	cp configs/wilkes/* .
-	./install.sh
+	cd mpich2
+	cp configs/$EP_CONFIG/* .
+	./install.sh $NUMCPUS
 cd ../petsc
-	cp configs/wilkes/* .
-	./install.sh
+	cp configs/$EP_CONFIG/* .
+	./install.sh $NUMCPUS
 cd ../metis
-	cp config/linux/* .
-	./install.sh
+	cp configs/$EP_CONFIG/* .
+	./install.sh $NUMCPUS
 cd ../triangle
-	cp config/lin64/* .
-	./install.sh
+	cp configs/$EP_CONFIG/* .
+	./install.sh $NUMCPUS
 cd $ISSM_DIR
 
@@ -66,27 +77,19 @@
 sh config/wilkes/linux64.sh
 
-#4: compile ISSM
-make -j 8
-make install
-
-#5: change issm.rc
-cd etc
-cat cluster.rc | sed -e "s/cluster_codepath=\/u\/astrid1\/larour\/issm\/trunk\/bin/cluster_codepath=\/u\/wilkes-r1b\/morlighe\/svn\/issm\/trunk\/cron\/trunk\/bin/g" | sed -e "s/cluster_executionpath=\/u\/wilkes-r1b\/larour\/Testing\/Execution/cluster_executionpath=\/u\/wilkes-r1b\/morlighe\/ExecutionNightlyRun/g"> cluster.bak
-mv cluster.bak cluster.rc
-cd ..
+#4: compile and install ISSM
+if [ -z $NUMCPUS ];
+then
+	make
+	make install
+else
+	make  -j $NUMCPUS
+	make  -j $NUMCPUS install
+fi
 
 #Launch matlab and the nightly run script
-if [[ package == "" ]]
-then
-	matlab -nojvm -nosplash  > ./nightlylong.log << EOF 
+matlab -nojvm -nosplash  > ./nightlylong.log << EOF 
 startup
-nightlyrun;
+nightlyrun($PACKAGES);
 EOF
-else
-	matlab -nojvm -nosplash  > ./nightlylong.log << EOF 
-startup
-nightlyrun($1);
-EOF
-fi
 
 #removed unused lines to deal with a smaller file
Index: /issm/trunk/cron/report.sh
===================================================================
--- /issm/trunk/cron/report.sh	(revision 1520)
+++ /issm/trunk/cron/report.sh	(revision 1521)
@@ -129,5 +129,5 @@
 
 		# go through the lines of $package.log
-		COUNTER=1
+		COUNTER=0
 		MAX=`wc -l $package.log | awk '{printf("%s",$1);}'`
 		while [  $COUNTER -lt $MAX ]; do
Index: /issm/trunk/cron/wilkes_config
===================================================================
--- /issm/trunk/cron/wilkes_config	(revision 1521)
+++ /issm/trunk/cron/wilkes_config	(revision 1521)
@@ -0,0 +1,20 @@
+#ISSM directory
+ISSM_DIR="/u/wilkes-r1b/morlighe/svn/issm/trunk/cron/trunk"
+
+#ISSM Architecture
+ISSM_ARCH="linux-gnu-amd64"
+
+#external pakages configs:
+EP_CONFIG="linux64"
+
+#number of cpus
+NUMCPUS=8
+
+#MATLAB path
+MATLAB_PATH="/usr/local/pkgs/matlab-7.6/"
+
+#execution path
+EXECUTION_PATH="/u/wilkes-r1b/morlighe/ExecutionNightlyRun"
+
+#packages to be run
+PACKAGES="{'macayeal','ice','cielo_serial','cielo_parallel'}"
