Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

cronic and msmtp are working as intended. The gsutil tool was sending confirmation messages to stderr:

$ /home/wolfv/gsutil/gsutil cp -r /home/wolfv/testSource /home/wolfv/testLocalDest > msg.stdout 2> msg.stderr
$ cat msg.stdout
$ cat msg.stderr
Copying file:///home/wolfv/testSource/README.txt...

And gsutil has an option to quite the confirmation messages: $ gsutil help options ... -q Causes gsutil to perform operations quietly, i.e., without reporting progress indicators of files being copied or removed, etc. Errors are still reported. This option can be useful for running gsutil from a cron job that logs its output to a file, for which the only information desired in the log is failures.

$ /home/wolfv/gsutil/gsutil -q cp -r /home/wolfv/testSource /home/wolfv/testLocalDest > msg.stdout 2> msg.stderr
$ cat msg.stdout
$ cat msg.stderr

So I put -q in the backup_script and everything works fine now.

And this is the email when there is an error on line 13 of the backup_script: RESULT CODE: 0

ERROR OUTPUT:
/home/wolfv/backup_script: line 13: uncomment: command not found

STANDARD OUTPUT:

cronic and msmtp are working as intended. The gsutil tool was sending confirmation messages to stderr:

$ /home/wolfv/gsutil/gsutil cp -r /home/wolfv/testSource /home/wolfv/testLocalDest > msg.stdout 2> msg.stderr
$ cat msg.stdout
$ cat msg.stderr
Copying file:///home/wolfv/testSource/README.txt...

And gsutil has an option to quite the confirmation messages: messages:

$ gsutil help options
 ...
 -q    Causes gsutil to perform operations quietly, i.e., without
       reporting progress indicators of files being copied or removed,
       etc. Errors are still reported. This option can be useful for
       running gsutil from a cron job that logs its output to a file, for
       which the only information desired in the log is failures.

failures.

$ /home/wolfv/gsutil/gsutil -q cp -r /home/wolfv/testSource /home/wolfv/testLocalDest > msg.stdout 2> msg.stderr
$ cat msg.stdout
$ cat msg.stderr

So I put -q in the backup_script and everything works fine now.

And this is the email when there is an error on line 13 of the backup_script: RESULT CODE: 0

ERROR OUTPUT:
/home/wolfv/backup_script: line 13: uncomment: command not found

STANDARD OUTPUT:

I reinstalled msmtp and then it worked. Once the email was working, cronic was sending email on every cron run, even when there was no error. Which was fixed as follows.

cronic and msmtp are working as intended. The gsutil tool was sending confirmation messages to stderr:

$ /home/wolfv/gsutil/gsutil cp -r /home/wolfv/testSource /home/wolfv/testLocalDest > msg.stdout 2> msg.stderr
$ cat msg.stdout
$ cat msg.stderr
Copying file:///home/wolfv/testSource/README.txt...

And gsutil has an option to quite the confirmation messages:

$ gsutil help options
...
-q    Causes gsutil to perform operations quietly, i.e., without
      reporting progress indicators of files being copied or removed,
      etc. Errors are still reported. This option can be useful for
      running gsutil from a cron job that logs its output to a file, for
      which the only information desired in the log is failures.

$ /home/wolfv/gsutil/gsutil -q cp -r /home/wolfv/testSource /home/wolfv/testLocalDest > msg.stdout 2> msg.stderr
$ cat msg.stdout
$ cat msg.stderr

So I put -q in the backup_script and everything works fine now.

And this is the email when there is an error on line 13 of the backup_script: RESULT CODE: 0

ERROR OUTPUT:
/home/wolfv/backup_script: line 13: uncomment: command not found

STANDARD OUTPUT: