title: Cron script executed but no output
body: <p>I've taken a look to many different topics and did not find an answer to my problem. I created 2 bash scripts on my Ubuntu server and I'm trying to execute them periodically. It seems they are running, but they produce nothing. They are executable:</p>
  
  <pre><code>drwxr-xr-x 14 root root     4096 Mar 14 18:02 ..
  -rwxr-xr-x  1 root root     2623 Apr 16 21:18 backup.pl
  -rw-r--r--  1 root root 87066352 May 10 21:37 full_site_backup-10-4-2018.tar.gz
  -rwxr-xr-x  1 root root      530 May 11 20:21 checkHealth.sh
  drwxr-xr-x  2 root root     4096 May 11 20:35 .
  </code></pre>
  
  <p>So here is one of my scripts:</p>
  
  <pre><code>#!/bin/bash
  
  # log stdout and stderr to two different files
  exec &gt;&gt;/var/log/test.log 2&gt;&gt;/var/log/test.err.log
  
  # ...and log every command we try to execute to stderr (aka looog.err.log)
  # set -x
  
  CODE=$(curl -s -o /dev/null -I -A "myuseragent" -w "%{http_code}" https://www.xxxxxxxxxxxxx.xxx/xxxx)
  
  DATE=$(date)
  
  if [ $CODE -gt 300 ]
  then
      service mysql restart
      service tomcat8 restart
      &gt;&amp;2 echo "$DATE - KO !!!!!! code retour $CODE"
  else
      echo "$DATE - OK, code $CODE"
  fi
  </code></pre>
  
  <p>and here is my <code>sudo crontab -e</code> :</p>
  
  <pre><code># m h  dom mon dow   command
  
  0 2 * * * root /usr/bin/perl /var/backup/backup.pl
  * * * * * root /bin/sh /var/backup/checkHealth.sh
  </code></pre>
  
  <p>and here is my <code>sudo tail -f /var/log/cron.log</code>:</p>
  
  <pre><code>May 11 20:39:01 ns381471 CRON[10778]: (root) CMD (root /bin/sh /var/backup/checkHealth.sh)
  May 11 20:39:26 ns381471 crontab[10823]: (root) BEGIN EDIT (root)
  May 11 20:40:01 ns381471 CRON[10880]: (root) CMD (root /bin/sh /var/backup/checkHealth.sh)
  May 11 20:40:01 ns381471 CRON[10879]: (root) CMD (/usr/local/rtm/bin/rtm 2 &gt; /dev/null 2&gt; /dev/null)
  May 11 20:40:30 ns381471 crontab[10823]: (root) END EDIT (root)
  May 11 20:41:01 ns381471 CRON[10974]: (root) CMD (/usr/local/rtm/bin/rtm 2 &gt; /dev/null 2&gt; /dev/null)
  May 11 20:41:01 ns381471 CRON[10975]: (root) CMD (root /bin/sh /var/backup/checkHealth.sh)
  May 11 20:42:01 ns381471 CRON[11070]: (root) CMD (/usr/local/rtm/bin/rtm 2 &gt; /dev/null 2&gt; /dev/null)
  May 11 20:42:01 ns381471 CRON[11071]: (root) CMD (root /bin/sh /var/backup/checkHealth.sh)
  </code></pre>
  
  <p>Any help would be appreciated. Thanks</p>