/
sbin
/
Upload File
HOME
#!/bin/sh umask 077 trap 'rm -rf $_tmpd' EXIT INT TERM _tmpd=$(mktemp -d) || exit 1 _out=$(mktemp ${_tmpd}/out.XXXXXX) || exit 1 _yum_cmd='/usr/bin/yum' _imunifyemail_dsn=/usr/share/imunifyemail/imunifyemail.dsn SENTRY_DSN= export SENTRY_DSN if [ -x /usr/bin/sentry-cli -a -r "$_imunifyemail_dsn" ] ; then SENTRY_DSN=$(head -1 "$_imunifyemail_dsn") # catch the output if any exec 3>&1 exec 4>&2 exec >$_out fi _err=0 $_yum_cmd check-update -q imunifyemail > /dev/null if [ $? -eq 100 ] ; then $_yum_cmd update -q -y imunifyemail _err=$(($_err + $?)) sleep 10s || true fi if [ -n "$SENTRY_DSN" ] ; then # restore stdout/stderr and show bufferized messages exec 1>&3 exec 2>&4 cat $_out # error condition detected - report it if [ $_err -ne 0 ] ; then _hostname=`hostname` /usr/bin/sentry-cli send-event \ -e "source:cron" \ -e "errorcode:$_err" \ -e "hostname:$_hostname" \ -m "imunifyemail cron error" \ --logfile $_out fi fi exit $_err