Backup bash manuscript is not gzipping its tarball

I have a bash manuscript that runs as a cron to backup documents on the web server.

#!/bin/bash
FILE=/path/to/backup_$(date +%Y%m%d).tar
tar -cf $FILE /backup/this /and/that /and/someotherfiles
gzip $FILE

When I run the manuscript straight making use of:

sudo bash ./backup-files.sh

It gzips the documents, yet last evening when the cron ran it left it as a tar. Would certainly the cron have conserved a log someplace that would certainly indicate why this may hold true?

0
2019-05-06 22:06:07
Source Share
Answers: 3

Is the dividing where backup lies at its restrictions?

Your manuscript has actually developed the tarball, yet gzip really did not have any kind of room entrusted to compress it.

(you can incorporate both commands with - z flag for tar)

Woops, I neglected one point : add - v flag to your tar command. It will certainly present what it does.

0
2019-05-08 18:43:54
Source

As Pierre has actually stated, you might intend to make use of the - z flag. Usually, I constantly make use of tar zcvfP for supporting whole directory sites and also maintaining their framework and also approvals. The v flag exists also, additionally valuable.

0
2019-05-08 17:45:08
Source

If it takes place once more that your manuscript does not do what you desire, you can add set -x in addition to your manuscript. It will certainly result specifically what it does and also this result is usually handy to locate pests. If you call it as a cronjob see to it that $EMAIL is set ideal.

0
2019-05-08 17:23:34
Source