Simple output to Stderr?

Rclone write its messages to stderr. It writes there in any case, if there is no error also.
It seems strange to me, and it give me few problems as far I’m runninc it via “cronic” in the crontab (http://habilis.net/cronic/)

Is there any option to avoid this behaviour?
Thanks

1 Like

If you want to send stderr to stdout, just use 2>&1 in the shell

And what about real errors? We will need them in the stderr

Could you explain further the problem you are trying to solve - it seems I’ve mis-understood what you are trying to achieve.

Every bash process writes to stdout the “normal” messages (infos, debug msg…, etc) and errors messages to stderr. This behavior allow parent processes to make choices.
We can see the “exit code” as another kind of interprocess comunication, but some softwares as “cronic” look at the stderr messages to see if subprocess had problems. A subprocess can reach the target, but if its important warnings go to stderr cronic bring them to the user attection.

What it cronic"? “Cronic is a small shim shell script for wrapping cron jobs so that cron only sends email when an error has occurred. Cronic defines an error as any non-trace error output or a non-zero result code.”

I’m using it very extensively, but with rclone it fails because rclone writes everything to stderr. So, for example, in the following message there is no warning and no errors, but it is entirely written in the stderr:

Cronic detected failure or error output for the command:
/var/server/lib/script_cron/rclone_controllers.sh

RESULT CODE: 0

ERROR OUTPUT:
2017/03/16 13:21:03 
Transferred:   6.212 MBytes (103.967 kBytes/s)
Errors:                 0
Checks:              1412
Transferred:           16
Elapsed time:      1m1.1s

2017/03/16 13:21:41 Local file system at /var/server/repository/public/R&D - Controllers: Waiting for checks to finish
2017/03/16 13:21:41 Local file system at /var/server/repository/public/R&D - Controllers: Waiting for transfers to finish
2017/03/16 13:21:41 Waiting for deletions to finish
2017/03/16 13:21:41 
Transferred:   8.607 MBytes (88.126 kBytes/s)
Errors:                 0
Checks:              2681
Transferred:           22
Elapsed time:       1m40s

STANDARD OUTPUT:

Obviously I can redirect everything to stdout, but I can also redirect to /dev/null … in my case it is the same: I’m losing the “real” errors! Network problems, privilege problems, or others. So it can run for months without let me understand that it is not working. Note that my servers could have dozen of crontab jobs; cronic allow me to survive :slight_smile:

Thanks for your attention! I’m using rclone since one week ago and it seems to me very interesting

I see. Probably what you want to do is upgrade to rclone 1.36. By default rclone 1.36 will log nothing unless it needs your attention - that is probably what you want for cronic.

If something goes wrong, rclone will always exit with a non-zero error code.

Ok for the version 1.36.
Thanks for your support