title: Run s3cmd sync via python script & cron
body: <p>I've been trying to trouble this for days now, and would appreciate some help --</p>
  
  <p>Basically, I wrote the following Python script</p>
  
  <pre><code>import os, sys
  
  # =__=__=__=__=__=__=__ START MAIN =__=__=__=__=__=__=__
  if __name__ == '__main__':
  
  # initialize variables
  all_files = []
  
  # directory to download data siphon files to
  dDir = '/path/to/download/directory/'
  
  # my S3 bucket
  s3bucket = "com.mybucket/"
  
  foldername = "test"
  
  # get a list of available feeds
  feeds = &lt;huge JSON object with URLs to feeds&gt;
  
  for item in range(feeds['count']):
      # ...check if the directory exists, and if not, create the directory...
      if not os.path.exists(folderName):
          os.makedirs(folderName)
  
      ... ... ...
  
      # Loop through all the splits
      for s in dsSplits:
          ... ... ...
          location = requestFeedLocation(name, timestamp)
  
          ... ... ...
          downloadFeed(location[0], folderName, nameNotGZ)
  
      # THIS IS WHERE I AM HAVING PROBLEMS!!!!!!!!!!!
      cmd = 's3cmd sync 'dDir+folderName+'/ s3://'+s3bucket+'/'
      os.system(cmd)
  </code></pre>
  
  <p>Everything in my code works...when I run this straight from the command line, everything runs as expected...however, when I have it executed via cron -- the following DOES NOT execute (everything else does)</p>
  
  <pre><code># THIS IS WHERE I AM HAVING PROBLEMS!!!!!!!!!!!
  cmd = 's3cmd sync 'dDir+folderName+'/ s3://'+s3bucket+'/'
  os.system(cmd)
  </code></pre>
  
  <p>To answer a few questions, I am running the cron as root, s3cmd is configured for the root user, OS is Ubuntu 12.04, python version is 2.7, all of the necessary directories have Read / Write permissions...</p>
  
  <p>What am I missing?</p>