title: Passing a variable to a js script from a shell script
body: <p>I have the following shell script, that kicks off a js script against mongo db I wish to pass a variable to the js file. A second caveat is that I need to store this variable somewhere on the unix box to as the last run time of the script. Any help or pointers is appreciated.</p>
  
  <pre><code># check if previous job still running
  if [ -f /tmp/mapreduce_compound.lck ]
  then
      exit
  else
     # if no lock file present, create one
     touch /tmp/mapreduce_compound.lck
  fi
  
  mongo -u xxx mongo1.pilot.dice.com:27017/tracking /usr/local/gemini/mongodb/tracking/mapReduceFunctionsByGroupIdIterative.js &gt; /tmp/mapReduceFunctionsByGroupIdIterative.txt 2&gt;&amp;1
  
  
  #remove lock file
  rm /tmp/process_nightly.lck
  </code></pre>