echo "#!/bin/sh">/tmp/log_gen.sh; echo "## DD-WRT Log HTML generator">>/tmp/log_gen.sh; echo "## Instructions:">>/tmp/log_gen.sh; echo "## put script in /tmp/www/">>/tmp/log_gen.sh; echo "## chmod 700 /tmp/www/log_gen.sh">>/tmp/log_gen.sh; echo "## Add cron job in Administrations panel">>/tmp/log_gen.sh; echo "## */15 * * * * root /tmp/www/log_gen.sh">>/tmp/log_gen.sh; echo "## Page available in http:///user/syslog.html">>/tmp/log_gen.sh; echo "## Change nline for number of generated lines">>/tmp/log_gen.sh; echo " ">>/tmp/log_gen.sh; echo "# Options">>/tmp/log_gen.sh; echo "nlines=\"500\"">>/tmp/log_gen.sh; echo "in=\"/var/log/messages\"">>/tmp/log_gen.sh; echo "out=\"/tmp/www/syslog.html\"">>/tmp/log_gen.sh; echo " ">>/tmp/log_gen.sh; echo "# Leave me alone">>/tmp/log_gen.sh; echo "name=\(nvram get router_name);">>/tmp/log_gen.sh; echo "date=\(date)">>/tmp/log_gen.sh; echo " ">>/tmp/log_gen.sh; echo "tail -n \nlines \in | awk -v NAME=\"\name\" -v DATE=\"\date\" \'BEGIN {">>/tmp/log_gen.sh; echo "print \"\"NAME\" - Syslog\"">>/tmp/log_gen.sh; echo "print \"\"">>/tmp/log_gen.sh; echo "print \"
System Log
(Generated: \"DATE\")

\"">>/tmp/log_gen.sh; echo "print \"\"">>/tmp/log_gen.sh; echo "}">>/tmp/log_gen.sh; echo " ">>/tmp/log_gen.sh; echo "{">>/tmp/log_gen.sh; echo "if ( \5 ~ /.crit/ || \5 ~ /.alert/ || \5 ~ /.err/ ) COLOR=\"red\";">>/tmp/log_gen.sh; echo "else COLOR=\"#5f5f5f\";">>/tmp/log_gen.sh; echo "print \"\"">>/tmp/log_gen.sh; echo "print \"\"">>/tmp/log_gen.sh; echo "print \"\"">>/tmp/log_gen.sh; echo "print \"\"">>/tmp/log_gen.sh; echo "print \"
Date/TimeSeverityMessages
\"\1\" \"\2\" \"\3\"\"\5\"\"">>/tmp/log_gen.sh; echo "}">>/tmp/log_gen.sh; echo " ">>/tmp/log_gen.sh; echo "{">>/tmp/log_gen.sh; echo "for (i=6; i>/tmp/log_gen.sh; echo "print \NF;">>/tmp/log_gen.sh; echo "}">>/tmp/log_gen.sh; echo " ">>/tmp/log_gen.sh; echo "END {">>/tmp/log_gen.sh; echo "print \"
\"">>/tmp/log_gen.sh; echo "print \"\"">>/tmp/log_gen.sh; echo "}\' > \out">>/tmp/log_gen.sh; sh /tmp/log_gen.sh;