
Being a Ham Radio operator, I’ve wanted, for some time, to display my log file on my web site. I’ve been researching it for some time, and mostly ran into methods that require java or php, or some sort of web scripting. This is beyond me and I wanted something simpler; and this is what I have come up with.
My computers run on the Ubuntu Linux Operating System. I came across a small command line utility program called txt2html. The name pretty much explains what it does. It has many features that include many formatting options; one being, that I can pre-append a file to the front of another file. I tested this feature to apply a preformatted html heading to my log page. I made a simple sample of a text log page listing contacts, and ran it through txt2html and it attached my header to the log page and spit it all out as an html file ready to display on my web page.
My sample log page was called log.txt and looks like this:
call QTH k7jm Helena, MT wa7vxm Butte, MT |
My sample heading was called ‘log_file_heading.html’ and looks like this:
K7JM’s Log File
I put it all through txt2html with a command like this:
txt2html --append_head ./log_file_heading.html ./log.txt >./log.html
And the output file ‘log.html’ looks like this and is ready to display on your web page:
K7JM’s Log Filecall QTH k7jm Helena, MT wa7vxm Butte, MT |
I wanted to automate a way to put this file on my web site without getting too complicated. The simple ftp command would work, but it takes a bit to automate it. After a bit of research, I came across ‘kermit‘. ‘kermit’ is a simple program that takes data from a file and performs the commands listed in the file. Perfect. I put the following commands in a file called ‘log.kermit’:
ftp open ftp.myhostsite.net /user:myusername /password:mypassword
put ./log.html /www/whereyou/wantit/log.html
exit
I then called kermit like this:
kermit ./log.kermit
and it is done.
To make things a bit cleaner and more automatic, I created a script file called ‘log_doit.sh’ that looks something like this:
txt2html –append_head /home/john/Desktop/log_file_heading.html /home/john/Desktop/cqrlog.html >/home/john/Desktop/log.html
kermit /home/john/Desktop/log.kermit
exit
Now, to do the whole process, I just had to update my log file, save it, and run the script ‘log_doit.sh’ and it would be on my web site.
A New Way – With cqrlog
After I put all this together, I remembered hearing about a Linux logging program called cqrlog, on the ‘Linux In The Ham Shack‘ (link updated 9/2010) podcast. If you are a Ham Radio Operator or use Linux, I strongly suggest you give this great podcast a listen. It is always entertaining, and they have covered some very useful stuff for the Ham that is running a Linux operating system.
Anyway, I downloaded and installed ‘cqrlog’ and started playing with it. I was specifically looking for a way to export the log file so I could run it through ‘txt2html’. Lo and behold, ‘cqrlog’ does one step better; it exports the log right into the ‘html’ format. Wow! Perfect!.
I learned a lot by using txt2html, but now I can skip that step completely and just export the log file in html format and run a simpler script that runs ‘kermit’ to upload the file to my web site. Click HERE to see the actual page on my web site. As of when this was written, the file is a test one that was created by playing with ‘cqrlog’. It will change once I start using ‘cqrlog’ for real.
John – K7JM
K7JM’s Log File
call QTH k7jm Helena, MT wa7vxm Butte, MT