* * * * * /usr/bin/mysqldump -h localhost -u source -p source mydb | gzip > /var/backup/all/database_`date +%Y-%m-%d`.sql.gz >/dev/null 2>&1when the crontab operation there is no backup document in the folder (my backup/all has the permission plan 755).
This is error from /var/log/syslog
Aug 16 11:55:01 precise64 CRON<2213>: (vagrant) CMD (/usr/bin/mysqldump -h localhost -u source -p source mydb | gzip > /var/backup/all/database_`date +%Y-%m-%d`.sql.gz >/dev/null 2>&1)Aug 16 11:55:01 precise64 CRON<2212>: (CRON) details (No MTA installed, discarding output)So i thinkit"s around crontab can"t produce backup document because the Permission denied.it"s around I"m didn"t install MTA yet I usage >/dev/null 2>&1 to disable crontab to sent it to email why that error ?
enhance this question
edited Aug 21 "14 at 11:58
6,71655 yellow badges2525 silver- badges5454 bronze title
inquiry Aug 16 "14 at 15:26
Kanin PeanviriyakulkitKanin Peanviriyakulkit
16511 gold badge11 silver- badge44 bronze title
add a comment |
3 answers 3
energetic oldest Votes
Of course, the error is that you don"t have a mailer (sendmail,postfix, etc) implemented and active.
That being claimed your other difficulty is that the >/dev/null 2>&1 just only applies/associates come the critical command in this instance gzip. Thus there need to be some form of output going to STDERR for your mysqldump.
You are watching: Cron info no mta installed discarding output
The correct method to carry out what ns think you desire is:
* * * * * (command | command ) >/dev/null 2>&1
improve this answer
reply Aug 16 "14 at 18:20
6,28633 gold badges2727 silver badges4242 bronze badges
include a comment |
You deserve to put:
MAILTO=""at the beginning of your crontab record and the will protect against it native trying to send email.
boost this price
answered may 21 "16 in ~ 3:30
Michael ElkevizthMichael Elkevizth
16111 silver badge22 bronze badges
add a comment |
If the user to run the crontab command is vagrant, and also the brochure where the calculation is written to is own by root, and has permissions 755, it deserve to not be composed to.sudo chown vagrant /var/backup/allmay fix that.
To inspect whether that"s the problem, shot writing to a file in /tmp instead.
But over there is one more problem: A command likemysqldump mydb | gzip > database.sql.gz >/dev/null 2>&1writes the database dump come database.sql.gz and also to /dev/null.The 2>&1 duplicates the error message to the standart output, that means it likewise writes the error messages to database.sql.gz. That writes error message text just some where in between the compressed data, for this reason the compressed document will it is in broken. Note it may work fine when testing - together the difficulty only occurs when something is written to the typical error stream. The calculation to stderr may be just a warning, while whatever else works.
See more: Why Did Griffith Sleep With Charlotte, Okay Ummmm Griffith Gay
I i think you intend to compose the compressed database dump come the sql.gz file, and also the errors to /dev/null. For this, simply keep the output streams separate, by not copying the error stream come the calculation stream. And direct them come the files like this:
mysqldump mydb | gzip > /var/backup/all/database_`date +%Y-%m-%d`.sql.gz 2>/dev/nullThe error message "(No MTA installed, discarding output)" is cron informing you the it deserve to not send friend the error output. That will certainly be no difficulty in the finish as you redirect errors to /dev/null anyway, there will be nothing come send. Yet I doubt that right now there are error message to send, that need to confirm my result above.