Re: Debugging CGI
- Posted by jmduro Oct 09, 2018
- 1662 views
Small improvement in the debug script: no need to show logs if an error happens.
#!/bin/bash echo "--------------------------------------------------------------------------------" echo "Debug starts at $(date +"%Y-%m-%d %H:%M:%S")" echo "--------------------------------------------------------------------------------" echo -e "\n/usr/lib/cgi-bin/ex.err" if [ -f /usr/lib/cgi-bin/ex.err ] then head -20 /usr/lib/cgi-bin/ex.err exit else echo "Not found" fi echo -e "\n/usr/lib/cgi-bin/error.log" [ -f /usr/lib/cgi-bin/error.log ] && cat /usr/lib/cgi-bin/error.log || echo "Not found" for i in $(ls -1tr log/*) do echo -e "\n$i" cat $i done
Jean-Marc