I have a bash script running as cron job which has some gcloud commands in it.
eg.
gcloud compute firewall-rules update allow-ssh--source-ranges=$(echo "${mylocations[@]}" | tr ' ' ',')
I have the crontab entry redirecting stdout to /dev/null, so that I don't get emails every time it runs.
The problem is that gcloud's output goes to stderr, even when there is no error, so I get emails like this:
TITLE: Cron user@host /home/user/bin/firewall-update.sh >/dev/null
Updated [https://www.googleapis.com/compute/v1/projects/project-name-4234534/global/firewalls/allow-ssh].
...
I have tried adding --verbosity=error
, critical
and none
to the gcloud commands, but they have no effect.
So how do I stop gcloud from sending this message to stderr when it completes successfully? Why does it even do that?