title: Is a single bash script the answer? gnu plot, MySQL
body: <p>The goal is to make a graph (gnuplot) every month, containing the last 13 months of rows per month (MySQL)[so the 2-D graph will have 13 x-axis entries], one graph per customer.</p>
  
  <p>Stepping back, is bash the right answer? I'd say I'm an advanced noob, but have not done for statements before, so I'm not sure how to approach this.</p>
  
  <p>MySQL- I have a single mysql CLI line that I can get to run in a bash script with a variable (the time period) - it runs just fine:</p>
  
  <pre><code>PER003="'2013-08-01 00:00:00' AND '2013-08-31 23:59:59'"
  
  mysql -uroot -password -h 192.168.x.x dbname -se "SELECT COUNT(*) FROM tablename WHERE study.created_time BETWEEN $PER003;"
  </code></pre>
  
  <p>I know all the periods, as they are months of time, but in the specified format. So I could make PER004, PER005, etc. as variables.</p>
  
  <p>I'm not quite worried about the gnuplot issue yet, but am wondering if am I approaching this the right way? Should I make a script per customer(each customer has their own db). Should the time periods be listed in the script or be called from an external file?(because if I have to add time periods manually each month, I'd like to do it once, rather than have to edit each customer script). Also, could I make another external file that contains each customer db and IP for the mysql command, and do a loop calling those variables for that as well?</p>
  
  <p>I'm just trying to wrap my head around what all is needed and the correct approach before I dive in..... THANKS!</p>