title: Bash script if else execute once cronjob every minute
body: <p>I have a bash script in crontab that runs every minute.
  In this bash script i have a sql query which goes and check for the number
  If the number is greater than predefined number then I want to move files and replace files. 
  This works absolutely fine, the problem is that since this script runs every minute via crontab, when the script runs next time it overwrites the file. </p>
  
  <p>Is there any logic that I can put that this code is only run once but let the cron run every minute. </p>
  
  <p>here is the code</p>
  
  <pre><code>#!/bin/bash
  count=`mysql -B -u root -ppassword -e 'select count(*) from column' table | tail -n +2`
  allowed="500"
  
  if [ "$count" -ge "$allowed" ]
  then
  mv /netboot/var/www/html /usr/html/
  mv /netboot/var/www/back /netboot/var/www/html
  echo "Not Allowed - Disable Code goes here"
  else
  echo "all is good for now $count"
  fi
  exit 0
  </code></pre>
  
  <p>Your help is appreciated.</p>