I have the following crontab to pull an online resource at 9am every day and write it to a file locally:
0 9 * * * /usr/bin/wget --http-user=username --http-password=password https://remote_file_to_pull.json -O /local_output_file.json >/dev/null 2>&1
The problem is that sometimes when retrieving the remote file, the server throws a Error 500. What
wget does is write over an empty file.
Is there a way to change the
cron to only write the file if
wget does not encounter an error and/or the file to write is not empty?