wget
成功したときと失敗したときの''の終了ステータスは何ですか?ほとんどの場合、ゼロ以外の終了ステータスで障害が報告されます。この場合、ほとんどの場合、些細なことです。
if wget http://example.com/remote/file ...
then mailx -s "File arrived at $(date)" victim@example.com < /dev/null
else mailx -s "File did not arrive at $(date)" other@example.com < /dev/null
fi
''からの出力を分析する必要がある場合は、wget
それをキャプチャして分析します。
wget http://example.com/remote/file ... >wget.log 2>&1
x=$(tail -2 wget.log | sed 's/.*file.exe/file.exe/')
if [ "$x" = "file.exe' -- not retrieving." ]
then mailx -s "File did not arrive at $(date)" other@example.com < /dev/null
else mailx -s "File arrived at $(date)" victim@example.com < /dev/null
fi
ただし、この場合、他のメッセージが原因で他のエラーが発生し、それが不正確なメール送信につながる可能性があることを心配しています。