我已经试了好几天了,希望能帮上忙--
基本上,我编写了以下Python脚本
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 = <huge JSON object with URLs to feeds>
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)在我的代码works...when中,我直接从命令行运行,所有东西都以expected...however的形式运行,当我让它通过cron执行时--下面的内容不执行(其他一切都执行)
# THIS IS WHERE I AM HAVING PROBLEMS!!!!!!!!!!!
cmd = 's3cmd sync 'dDir+folderName+'/ s3://'+s3bucket+'/'
os.system(cmd)为了回答一些问题,我将cron作为root运行,s3cmd配置为root用户,OS为Ubuntu12.04,python版本为2.7,所有必需的目录都具有读写权限.
我遗漏了什么?
发布于 2014-04-08 03:25:22
所以我希望命令会像下面这样。
cmd = 's3cmd sync‘+dDir+foldername+’s3://'+s3bucket+'/‘ os.system(cmd)
这里我找到了一些更多的s3cmd同步帮助:http://tecadmin.net/s3cmd-file-sync-with-s3bucket/
https://stackoverflow.com/questions/17904255
复制相似问题