#!/bin/bash # Script to generate highlighted source code files using # highlight by Andre Simon, http://www.andre-simon.de/ # HL="/usr/bin/highlight" base_dir="/home/http-user/temp-root" work_dir="$base_dir/nattsjo_control/info" temp_web_scripts="$base_dir/scripts" control_web_scripts="$base_dir/nattsjo_control" plot_dir="/home/josefk/bin/temp" sheeva="/usr/bin/ssh ina.nattsjo.se -l root -p 1122 " pushd $work_dir # Control PHP # $HL -u UTF-8 -i $control_web_scripts/index.php -o nattsjo_control.php.html $HL -u UTF-8 -i $control_web_scripts/control.php -o nattsjo_control_control.php.html $HL -u UTF-8 -i $control_web_scripts/report.php -o report_control.php.html $HL -u UTF-8 -i $control_web_scripts/suid_wrapper.c -o suid_wrapper.c.html cat $base_dir/nattsjo/config.php | grep -v -e "PASS" -e "DBUSER"| $HL -u UTF-8 -S php -o config.php.html cat $control_web_scripts/config.php | grep -v -e "PASS" -e "DBUSER"| $HL -u UTF-8 -S php -o config.php_control.html # Insert hyperlinks sed 's/\$sheevaplug_cgi/\<a href='suid_wrapper.c.html'\>\$sheevaplug_cgi\<\/a\>/g' nattsjo_control_control.php.html > nattsjo_control_control.php_1.html sed 's/config.php/\<a href='config.php_control.html'\>config.php\<\/a\>/g' nattsjo_control_control.php_1.html > nattsjo_control_control.php.html sed 's/config.php/\<a href='config.php_control.html'\>config.php\<\/a\>/g' nattsjo_control.php.html > nattsjo_control_1.php.html rm -f nattsjo_control.php.html mv nattsjo_control_1.php.html nattsjo_control.php.html rm -f nattsjo_control_control.php_1.html # Single temp PHP # $HL -u UTF-8 -i $temp_web_scripts/index.php -o temp_index.php.html $HL -u UTF-8 -i $temp_web_scripts/init.php -o temp_init.php.html $HL -u UTF-8 -i $temp_web_scripts/daily_weekly.php -o temp_daily_weekly.php.html $HL -u UTF-8 -i $temp_web_scripts/monthly.php -o temp_monthly.php.html $HL -u UTF-8 -i $temp_web_scripts/yearly.php -o temp_yearly.php.html cat $temp_web_scripts/../nattsjo/config.php | grep -v -e "PASS" -e "DBUSER"| $HL -u UTF-8 -S php -o config.php.html $HL -u UTF-8 -i $temp_web_scripts/report.php -o report_temp.php.html # Insert hyperlinks sed 's/init.php/\<a href='temp_init.php.html'\>init.php\<\/a\>/g' temp_index.php.html > temp_index.php_1.html sed 's/daily_weekly.php/\<a href='temp_daily_weekly.php.html'\>daily_weekly.php\<\/a\>/g' temp_index.php_1.html > temp_index.php.html sed 's/monthly.php/\<a href='temp_monthly.php.html'\>monthly.php\<\/a\>/g' temp_index.php.html > temp_index.php_1.html sed 's/yearly.php/\<a href='temp_yearly.php.html'\>yearly.php\<\/a\>/g' temp_index.php_1.html > temp_index.php_2.html sed 's/config.php/\<a href='config.php.html'\>config.php\<\/a\>/g' temp_index.php_2.html > temp_index.php.html rm -f temp_index.php_?.html # Plot scripts # cat $plot_dir/tempplot.pl | grep -v -e "\$DBUSER =" -e "\$DBPASS" | $HL -u UTF-8 -S perl -o tempplot_pl.html cat $plot_dir/tempd.pl | grep -v -e "\$DBUSER =" -e "\$DBPASS =" | $HL -S perl -o tempd_pl.html cat $plot_dir/plot_nattsjo_composite.pl | grep -v -e "\$DBUSER =" -e "\$DBPASS" | $HL -u UTF-8 -S perl -o plot_nattsjo_composite_pl.html $HL -u UTF-8 -i $plot_dir/tempplot_solar.sh -o tempplot_solar_sh.html # sql # $HL -u UTF-8 -i $plot_dir/temp_db.sql -o temp_db.sql.html # this file # $HL -u UTF-8 -i mk_source.sh -o mk_source.sh.html # Sheevaplug perl scripts # $sheeva "cat bin/set_triggers.pl" | grep -v -e "DBUSER =" -e "DBPASS =" -e "password =" | $HL -u UTF-8 -S perl -o set_triggers_pl.html $sheeva "cat bin/set_tellstick.pl" | grep -v -e "DBUSER =" -e "DBPASS =" -e "password =" | $HL -u UTF-8 -S perl -o set_tellstick_pl.html $sheeva "cat bin/tempcdcd.pl" | grep -v -e "DBUSER =" -e "DBPASS =" -e "PASSWORD = " | $HL -u UTF-8 -S perl -o tempcdcd_pl.html $sheeva "cat bin/pannrum.pl" | grep -v -e "DBUSER =" -e "DBPASS =" | $HL -u UTF-8 -S perl -o pannrum_pl.html $sheeva "cat bin/reboot_pannrum.sh" | grep -v -e "DBUSER =" -e "DBPASS =" | $HL -u UTF-8 -S bash -o reboot_pannrum_sh.html $sheeva "cat bin/elpatron.pl" | grep -v -e "my \$password" | $HL -u UTF-8 -S perl -o elpatron_pl.html $sheeva "cat bin/elpatrond.pl" | grep -v -e "DBUSER =" -e "DBPASS =" | $HL -u UTF-8 -S perl -o elpatrond_pl.html # crontab $sheeva "cat /etc/cron.d/tellstick" | $HL -u UTF-8 -S txt -o tellstick_cron.html $sheeva "cat /etc/cron.d/temp" | $HL -u UTF-8 -S txt -o temp_cron.html cat /etc/cron.d/tempd | grep -v -e "-p" | $HL -u UTF-8 -S txt -o tempd_cron.html # Events $sheeva "cat bin/eventd-source/eventd.c" | $HL -u UTF-8 -S c -o eventd.c.htm $sheeva "cat bin/event_wrapper.pl" | grep -v -e "DBUSER =" -e "DBPASS =" | $HL -u UTF-8 -S perl -o event_wrapper_pl.html $sheeva "cat bin/log_event.pl" | grep -v -e "DBUSER =" -e "DBPASS =" -e "password ="| $HL -u UTF-8 -S perl -o log_event_pl.html $HL -u UTF-8 -i $control_web_scripts/events.php -o events.php.html # Insert hyperlinks sed 's/\/root\/bin\/event_wrapper.pl/\<a href='event_wrapper_pl.html'\>\/root\/bin\/event_wrapper.pl\<\/a>/g' eventd.c.htm > eventd.c.html rm -f eventd.c.htm cp -xa /home/josefk/dokument/Development/avr/lcd_temp/html/* /home/http-user/temp-root/nattsjo_control/info/lcd_temp/ cp -xa /home/josefk/dokument/Development/avr/lcd_temp/backup/lcd_temp.tar.gz /home/http-user/temp-root/nattsjo_control/info/lcd_temp/ popd