title: How to pass parameters while invoking script in cron?
body: <p>I want to execute a script with some parameters as a cron job. I have configured the crontab using <code>crontab -e</code> with the following content</p>
  
  <pre><code>*/2 * * * * /root/todo-api/workspace/docker.sh c4e842c79337
  </code></pre>
  
  <p>but it is not working. When I used</p>
  
  <pre><code>*/2 * * * * /root/todo-api/workspace/docker.sh
  </code></pre>
  
  <p>it worked. How to pass parameters while invoking a script in cron? Here is my docker.sh script and it works if I directly execute it from shell.</p>
  
  <pre><code>CONTAINER=$1    
  
  RUNNING=$(docker inspect --format="{{.State.Running}}" $CONTAINER 2&gt; /dev/null)
  
  if [ $? -eq 1 ]; then
    echo "UNKNOWN - $CONTAINER does not exist."
    exit 3
  fi
  
  if [ "$RUNNING" == "false" ]; then
    echo "CRITICAL - $CONTAINER is not running."
  curl -H "Content-type: application/json" -X POST -d '{"routing_key": "3ef61cda125048a390d46cdb8d425590","event_action": "trigger","payload": {"summary": "Docker Container '$CONTAINER' down", "source": "'$CONTAINER'", "severity": "critical" }}' "https://events.pagerduty.com/v2/enqueue"
    exit 2
  fi
  
  echo "OK"
  </code></pre>