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?
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.
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.
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