【发布时间】:2017-11-06 22:12:10
【问题描述】:
我有一个使用 curl 检索文件的 bash 脚本。当我从交互式 bash shell 运行它时它运行良好,但是当我使用 cron 运行脚本时 curl 失败并出现退出代码 56(接收网络数据失败)。我也收到一条错误消息
curl: (56) SSL read: errno -5961
有什么想法吗?
crontab 条目:
57 21 * * * /opt/tltutilities/lss/bin/get_hosts.sh 2>&1 | /bin/mail -s "get_hosts.sh" me@addr.edu
Bash 脚本:
#! /bin/bash
BASEDIR=/opt/tltutilities/lss
cd $BASEDIR/bin
curl -v -o /opt/tltutilities/lss/tmp/etc_hosts https://remote_host.edu/pub/hosts/hosts
rc=$?
if [ $rc -ne 0 ]
then
errmsg="curl: can't get hosts file: `grep \"^$rc \" curl_error_codes.txt`"
echo $errmsg
echo "$errmsg" | /bin/mail -s "get_hosts.sh failed with curl error $rc" me@addr.edu
fi
【问题讨论】: