better error reporting

This commit is contained in:
olli 2022-11-29 13:47:41 +01:00
parent 8e20c9a57b
commit fce544d6b5

View File

@ -70,10 +70,10 @@
group: root group: root
create: yes create: yes
marker: "# {mark} ANSIBLE MANAGED BLOCK" marker: "# {mark} ANSIBLE MANAGED BLOCK"
block: | block: |
[ -e /root/server-$(hostname -s)/$(hostname -s).sh ] && bash -ex /root/server-$(hostname -s)/$(hostname -s).sh >/var/log/server-$(hostname -s)-update.log 2>&1 [ -e /root/server-$(hostname -s)/$(hostname -s).sh ] && bash -x /root/server-$(hostname -s)/$(hostname -s).sh >/var/log/server-$(hostname -s)-update.log 2>&1
g_echo_warn "$(egrep -B1 "^changed" /var/log/server-$(hostname -s)-update.log)" g_echo_warn "$(egrep -B1 "^changed" /var/log/server-$(hostname -s)-update.log)"
g_echo_error "$(egrep -q -B1 -i "^error|^fatal" /var/log/server-$(hostname -s)-update.log && tail -n 50 /var/log/server-$(hostname -s)-update.log)" g_echo_error "$(egrep -q -B1 -i '^error|^fatal' /var/log/server-$(hostname -s)-update.log && egrep -B50 '^error|^fatal' /var/log/server-$(hostname -s)-update.log)"
backup: yes backup: yes
validate: /bin/bash -n %s validate: /bin/bash -n %s