WeeboTech Posted July 22, 2010 Share Posted July 22, 2010 Please consider adding the following to the script exec 2>&1 stderr seems to go nowhere. It may be worthwhile to put a logger line in there too. logger -tscripts/pre "$@" and after the eval, capture the rc and log it. or just check the RC and if not = 0, then log it as. logger -tscripts/pre "$@" ", RC:$?" here is my modified pre script. It only logs if the RC>0 #!/bin/bash # usage: pre <command> # Executes <command>, wrapping it's output in <pre></pre> tags. exec 2>&1 echo '<pre>' eval "$@" RC=$? echo '</pre>' if [ ${RC} -gt 0 ] then logger -t$0 -puser.err <<-EOF $@, RC:${RC}" EOF fi exit ${RC} here's my example. Jul 22 15:46:33 unraidvm /usr/local/webGui/scripts/pre: atx -f /etc/cron.daily/updatedb now, RC:127" Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.