我有一个shell脚本,它通过目录中的每个JSon文件并使用phantomJS创建一个高图表。Shell脚本从CLI运行,但不是从Crontab运行
调度cron任务来运行此脚本时出现问题 - (最初我使用inotifywait但得到相同的错误)。
shell脚本是这样的:
#!/bin/sh
for i in *.json; do
filename="${i%.*}"
phantomjs /var/www/highcharts.com/exporting-server/phantomjs/highcharts-convert.js -infile $i -outfile img/$filename.png -scale 2.5 -width 300 -constr Chart -callback /var/www/highcharts.com/exporting-server/phantomjs/callback.js
done
和定期任务看起来是这样的:
* * * * * /var/www/highcharts.com/exporting-server/phantomjs/test/createGraphs.sh >> /var/www/highcharts.com/exporting-server/phantomjs/highcharts.log
在我得到的错误日志文件:
“无法打开文件'* .json''
从命令行运行shell脚本时,shell脚本运行良好,b当试图安排它时,问题就来了。
确保JSON文件的读/写能力由用户在哪个cron运行 – Anubhab 2013-03-19 09:33:43