cron脚本从s3恢复备份不起作用

时间:2017-05-19 22:55:14

标签: amazon-web-services amazon-s3 cron

有一个shell脚本从aws s3中提取最新的备份。它工作正常。但是当我使用cron来安排恢复时,它不会运行。从查看输出,分配变量FILE存在一些问题。我不确定为什么cron表现不同。

从回显中,$ FILE的值为空

任何帮助都将不胜感激。

Dim k As Long
k = 0
Dim inputArr() As Variant
ReDim inputArr(myqcdData.Cells.Count)
For Each cell In MyQCData
    text_string = cell.Value

    WrdArray() = Split(text_string, ",")
    For i = LBound(WrdArray) To UBound(WrdArray)
        strg = strg & vbNewLine & "Part No. " & i & " - " & WrdArray(i)
    Next i
    inputArr(k) = InputBox("This part requires a " & WrdArray(0) & " measurement of the " & _
                           WrdArray(1) & vbNewLine & vbNewLine _
                           & "The range for this is input is " & vbNewLine & vbNewLine & "Lower Control Limit     " _
                           & WrdArray(2) & vbNewLine & "Upper Control Limit     " & WrdArray(3))
    k = k + 1
    Erase WrdArray()
Next cell

'Check each value in the array. This is optional and can be removed/commented out
For k = LBound(inputArr) To UBound(inputArr)
    Debug.Print inputArr(k)
Next k

1 个答案:

答案 0 :(得分:2)

Cron没有shell中的所有环境变量,因此/usr/local/bin可能不在cron的PATH上。尝试指定aws的完整路径:

FILE=`/usr/local/bin/aws s3 ls $BUCKET --recursive | sort | tail -n 1 | awk '{print $4}'`