Index: trunk/ippTasks/summit.copy.pro
===================================================================
--- trunk/ippTasks/summit.copy.pro	(revision 15298)
+++ trunk/ippTasks/summit.copy.pro	(revision 16173)
@@ -7,5 +7,15 @@
 # pztool -adddatastore -inst allskycam -telescope ps1 -uri  http://otis1.ifa.hawaii.edu/ds/allskycam/index.txt
 
-$workdir    = /data/ipp010.0/
+# the templates are used if we have a class_id/host relationship; if none is found, the default values are used
+# XXX not sure how to handle the .N value if we need to use more than one
+if ($NEBULOUS)
+ $workdir_default  = neb://
+ $workdir_template = neb://
+ $volume_default  = ipp004-v0
+ $volume_template = @HOST@-v0
+else
+ $workdir_default  = /data/ipp004.0/
+ $workdir_template = /data/@HOST@.0/
+end
 
 $VERBOSE = 1
@@ -34,4 +44,5 @@
     periods      -poll     1
     periods      -timeout  15
+    npending     1
 
     # success
@@ -231,5 +242,4 @@
     periods      -poll     0.05
     periods      -timeout  120
-    host        anyhost
 
     task.exec
@@ -264,16 +274,29 @@
         substr $DATEOBS 8 2 DAY
 
+        # we need to set the workdir based on 1) nebulous or not? 2) chip/host relationship
+        # this function uses workdir_template, workdir_default, volume_template, volume_default,
+        # it sets workdir and volume
+       	set.workdir.by.camera $CAMERA $CLASS_ID
+
         # figure out filename
+	# XXXX this filename needs to use nebulous names
         $FILENAME = $workdir/$CAMERA/$YEAR/$MONTH/$DAY/$EXP_NAME/$EXP_NAME.$CLASS_ID.fits
+        $FILEROOT = $workdir/$CAMERA/$YEAR/$MONTH/$DAY/$EXP_NAME/$EXP_NAME.$CLASS_ID
 
         book setword pzPendingImfile $pageName filename $FILENAME
+
+        set.host.by.camera $CAMERA $CLASS_ID
+        host        anyhost
 
         # store the pageName with this job
         options $pageName
-
-        if ($MD5SUM == 0) 
-            $run = dsget --uri $URI --filename $FILENAME --bytes $BYTES 
-        else
-            $run = dsget --uri $URI --filename $FILENAME --bytes $BYTES --md5 $MD5SUM
+        options $FILEROOT
+
+        $run = dsget --uri $URI --filename $FILENAME --bytes $BYTES 
+        if ($MD5SUM) 
+            $run = $run --md5 $MD5SUM
+        end
+        if ($NEBULOUS && ("$volname" != "NULL")) 
+            $run = $run --volume $volume
         end
 
@@ -295,6 +318,10 @@
         book getword pzPendingImfile $options:0 filename -var FILENAME
 
+	# we need to set the values of tess_id, dvodb, end_stage, workdir here 
+        # these are functions of (at least) EXP_TYPE and SURVEY_ID, both of which should come from the data store
+
 	# update the database with the success
-        $run = pztool -copydone -exp_name $EXP_NAME -inst $CAMERA -telescope $TELESCOPE -class $CLASS -class_id $CLASS_ID -uri $FILENAME
+        $run = pztool -copydone -exp_name $EXP_NAME -inst $CAMERA -telescope $TELESCOPE -class $CLASS -class_id $CLASS_ID -uri $FILENAME -workdir $options:1
+	# tess_id, dvodb, workdir, end_stage
 
         # create the command line
