#! /bin/sh # Run salt-call state.highstate, logging to /var/log/salt/nightly-highstate. # If there is an error, we cat the entire file to stdout, so cron will complain # to the admin. export PATH=/usr/local/sbin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/bin salt-call state.highstate --retcode-passthrough saltenv=base pillarenv=base > /var/log/salt/nightly-highstate 2>&1 RET=$? if [ $RET -ne 0 ] || grep '^Failed:[[:space:]]*[1-9][0-9]*$' /var/log/salt/nightly-highstate >/dev/null 2>&1; then cat /var/log/salt/nightly-highstate fi exit $RET