title: Why doesn’t crontab execute well my script
body: <p>I wrote a script that I want to execute every minute</p>
  <p>I wanna save my database every minute.</p>
  <p>My script:</p>
  <pre><code>#!/bin/sh
  DB_USER=&quot;root&quot;
  DB_PASS=&quot;root&quot;
  DB_HOST=&quot;localhost&quot;
  
  OUTDIR=`date +%Y-%m-%d/%H:%M:%S`
  
  mkdir -p /Users/mess/backup_DB/$OUTDIR
  
  DATABASES=`MYSQL_PWD=$DB_PASS mysql -u $DB_USER -e &quot;SHOW DATABASES;&quot; | tr -d &quot;| &quot; | grep -v -e Database -e _schema -e mysql`
  
  for DB_NAME in $DATABASES; do
      MYSQL_PWD=$DB_PASS mysqldump -u $DB_USER --single-transaction --skip-lock-tables $DB_NAME -h $DB_HOST &gt; /Users/mess/backup_DB/$OUTDIR/$DB_NAME.sql
  done
  
  for DB_NAME in $DATABASES; do
      gzip /Users/mess/backup_DB/$OUTDIR/$DB_NAME.sql
  done
  </code></pre>
  <p>When I execute my script it’s work but when I use cron to execute it automatically it’s doesn’t work, crontab create the folder but not the file (database.sql.zip)</p>
  <p>Here my cron :</p>
  <pre><code>PATH=/bin:/usr/bin:/usr/sbin:/Users/mess/scripts/bin
  
   * * * * * backup
  </code></pre>