| By Colin Mattoon | Article Rating: |
|
| January 29, 2002 12:00 AM EST | Reads: |
12,142 |
(LinuxWorld) -- Boa: noun [Latin]
- Angry serpent that Steve Irwin (well-known crazed Aussie crocodile hunter featured on Animal Planet) drags from it's burrow to fondle and coo over.
- Article of apparel often sported by otherwise scantily clad ladies in photographs depicting [censored]
- A lean and mean Web server well suited to slower processors and minimal RAM.
Despite the obvious entertainment value in watching Mr. Irwin get bitten by a 17 foot-long snake, or in admiring (censored and link to .jpg removed), we turn our attention to the third definition: a Web server.
We have been busy setting up a Text Messaging Gateway for our Linux Network for Peanuts (see Part 9, Part 10, and Part 11) and let's take a moment to review what we have accomplished thus far:
We began by adapting a machine loaded with Debian (originally configured as an X terminal) by changing it's name and IP to something more descriptive of it's new role as a Text Messaging Gateway.
Next, we added a dial-up modem so that this machine can dial the TAP/IXO modems of alphanumeric paging services and those of digital cellular and PCS providers.
We installed and configured QuickPage to send messages using the Simple Network Paging Protocol (SNPP) and tested our QuickPage configuration with the command-line client.
Sendmail was installed, along with procmail and an old standby: Elm, as a Mail User Agent (MUA) so we could transmit messages to phones and pagers that are generated as e-mails.
Now, the time has come to install and configure a Web server and create a simple CGI-BIN e-mail form so that our Linux X terminal users (and users of other browser equipped workstations) can connect to the Text Messaging Gateway to send messages without complicated mail configurations or additional client software installed on their machines or the application server.
Step 1. Catch that snake!
Boa isn't the only Web server we could use -- Apache works well -- and I'm sure some of the others will too. I like Boa for this application, because my unscientific observations are that it runs more quickly on 486 and first-generation Pentiums with 8 to 16 megabytes of RAM. For small operations that average less than 30 or 40 messages per hour, why not use something inexpensive? This is Cheap and Easy Linux server-centric computing, after all.You are an old hand at installing packages on a Debian system by now, so:
apt-get install boa
After grabbing the archives from Debian's server and installing the package, Apt reports that it is, "Starting HTTP server: Boa." This Linux sysadmin stuff is hard work, isn't it?
And I can see it all now, you lyin' dog! When you get home tonight:Significant Other: "How'd it go at work today, honey?"
You (lying dog that you are): "Oh, you'll never believe it, babe. I had to set up this intranet Web server and I'm just wiped out."
SO: "You poor thing...here, you just make yourself comfortable, and I'll go pour you a tumbler full of your favorite beverage!"
Yeah, I got your Web server.
Step 2. Forms, I need forms, I tell you!
If you know how, you could write your own CGI-Bin application and create your own Web-based e-mail forms for message entry. For the rest of us, why bother? MIT did the hard work for us already and provides us with cgiemail, a "CGI program written in C for Unix...to take the input of WWW forms and convert it to an e-mail format..."In short, the form (that Boa serves to our user's Web browsers) is converted to e-mail, and sendmail (with procmail's help) hands it off to QuickPage for delivery to pagers and cell phones, while placing a copy in /var/mail.
Let's get it quick!
apt-get install cgiemail
Whew! This is hard work!
Step 3. HTML 101
To keep things simple, we will only include two of our employees: Basil Buffoon from the personnel department and poor old Tom Smith from shipping. We want users to encounter a Web page that looks something like this when they point their browsers at the Gateway:
To write this page, change to the /var/www directory and with finest text editor known to mankind (Easy Editor), create a new file called index.html.
ee index.html
In this new file, type:
<HTML> <HEAD> <TITLE>ALPHABETIZED INDEX OF PAGERS</TITLE> </HEAD> <BODY BGCOLOR=#F0FFF0> <FONT size=+6> Welcome to our Text Messaging Gateway! </FONT> <BR> <P> <FONT size=+3> Click on one of the links below to send a text message to: <BR> <P> </font> <FONT size=+2> <UL> <LI><A HREF="basilbuffoon-form.html" TARGET=_blank>Basil Buffoon's Alpha-Pager</A> <LI><A HREF="tomsmith-form.html" TARGET=_blank>Tom Smith's PCS Phone</A> </UL> </FONT> <BR> </BODY> </HTML>
Save your changes to index.html and test your handiwork by pointing a Web browser at the IP of your Text Messaging Gateway. Feel free to buy a book with a tutorial on writing Web pages if you think mine "sux." It works, and that is all I care about!
Step 4. Tom gets his very own page
So does Basil, and so does everyone else you listed in index.html. Fire up the world's finest text editor (why, Easy Editor, of course) and create tomsmith-form.htmlee tomsmith-form.html
In that file, type the following:
<HTML> <HEAD> <TITLE>TOMSMITH-FORM</TITLE> </HEAD> <BODY> <H1><FONT size=+6>Send a message to Tom Smith's PCS phone:</FONT></H1> <FORM METHOD="POST" ACTION="http://192.168.1.2/cgi-bin/cgiemail/templates/tomsmith-template"> <BR> Message Body: <INPUT TYPE="text" NAME="messagebody" SIZE="65" MAXLENGTH="100"><P> <INPUT TYPE="submit" value="Send Page"> </FORM> </BODY> </HTML>
Save your changes, and repeat, only this time for Basil Buffoon:
ee basilbuffoon-form.html
Note the changes between the two example forms so that you can extrapolate to meet your own needs:
<HTML> <HEAD> <TITLE>BASILBUFFOON-FORM</TITLE> </HEAD> <BODY> <H1><FONT size=+6>Send a message to Basil Buffoon's Alpha-Pager:</FONT></H1> <FORM METHOD="POST" ACTION="http://192.168.1.2/cgi-bin/cgiemail/templates/basilbuffoon-template"> <BR> Message Body: <INPUT TYPE="text" NAME="messagebody" SIZE="65" MAXLENGTH="100"><P> <INPUT TYPE="submit" value="Send Page"> </FORM> </BODY> </HTML>
By "clicking" on the link to Tom Smith at our "Welcome Page" (index.html) we should be taken to:
Step 5. The missing link
Well, we have a "Welcome Page" named index.html that displays in our user's Web browsers, and we can enter text messages but they still don't go anywhere yet. For the next task, let's create a link in /var/www that points to the directory where cgiemail is installed on this Debian system. Make sure you are in the /var/www directory and use the ln utility to create a "symlink" like so:ln -s /usr/lib/cgi-bin cgi-bin
By running ls -l you should see:
lrwxrwxrwx 1 root root 16 Jan 27 21:02 cgi-bin -> /usr/lib/cgi-bin -rw-r--r-- 1 root root 360 Jan 27 20:52 basilbuffoon-form.html -rw-r--r-- 1 root root 463 Jan 27 20:50 index.html -rw-r--r-- 1 root root 366 Jan 27 20:51 tomsmith-form.html
See the "man pages" (man ls and man ln) for information on these utilities.
Step 6. Make a "templates" directory
Cgiemail uses "templates" for each e-mail address to which you want to send messages. Since each alphapager and phone you add to this system has it's own address, it helps keep everything neat and tidy to create a subdirectory to store them: /var/www/templates. Make the directory with mkdir.mkdir /var/www/templates
Change to that new directory, and with a text editor (oh, I don't care which one you use, but I'm going to use Easy Editor) create tomsmith-template and basilbuffoon-template as follows:
ee tomsmith-template
Here is the content of Tom's file:
To: tomsmith+page@localhost From:Our Company Message Body: [messagebody]
After saving the file, create Basil's:
ee basilbuffoon-template
Type this:
To: basilbuffoon+page@localhost From:Our Company Message Body: [messagebody]
Step 7. Turn this puppy up for production use!
Add each of your remaining users to index.html following the same format we used for Basil and Tom in Step 3, above.To save time creating the username-form.html files, you can use the cp command to create a new form and then edit the resulting form for each new user. Same for the templates you create in /var/www/templates.
In other words:
cp tomsmith-form.html janedoe-form.html
Use a text editor to make the minor changes required for "Jane Doe."
Having created templates, the final piece is in place and by pointing Netscape or other browser at our Text Messaging Gateway, users see:

By "clicking" on a link, they are taken to:

They enter their message for transmission:

As soon as they "click" on Send Page they see a "Success Page:."

Now, that wasn't so very difficult, was it?
What did we do?
We combined the capabilities of several relatively small applications to create a service for our Network for Peanuts that doesn't exist as a single application. A fundamental principle of Linux/Unix system administration: Boa-->cgiemail-->sendmail-->procmail-->QuickPage.We used the dog out of Debian's Apt utility, and every bit of software used was installed with apt-get install package-name.
We saved a bundle by not spending money for both Windows and a proprietary application that would also require a more powerful (and expensive) computer to provide this service.
What didn't we do?
We didn't write elegant HTML that makes for pretty Web pages. You are encouraged to read a book and apply that knowledge to clean up the example HTML provided in this article. I also encourage you to spend some time at MIT's cgiemail site to learn how to create templates and forms more suited to your particular needs.We also didn't create a Text Messaging Gateway suitable for the 'net. This modest project is intended for use on a LAN, behind a firewall, and you are warned!
That is enough for today, and for Text Messaging. Maybe 13 is an unlucky number. That's the next installment in our series and we will be tearing into another service for our Linux Network for Peanuts that used up most of my good luck!
Published January 29, 2002 Reads 12,142
Copyright © 2002 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
- Installing a text-messaging gateway on Debian
- Adding Sendmail to a text messaging gateway
- Cheap & easy business accounting with Linux
- Laying a foundation for free Linux accounting
- How to install Nola, the free accounting package for Linux
- How to upgrade Nola, the free accounting package for Linux
- How to create a Linux-based network of computers for peanuts
- How to create a Linux-based network of computers for peanuts (part 2)
- How to create a Linux-based network of computers for peanuts (part 3)
- How to create a Linux-based network of computers for peanuts (part 4)
- How to install Linux over a network
- How to Install Debian over a Network
- Finishing an installation of Debian over a network
- Configuring a text-messaging gateway with Linux
More Stories By Colin Mattoon
When not buried under his real job in commercial two-way radio system design and sales, Colin Mattoon is a part-time Linux system administrator at Northwest Communications in Lewiston, ID.
- Cloud CEOs, CTOs & SVPs to Speak at 4th International Cloud Computing Expo
- Practical Approaches for Optimizing Website Performance
- 1st Annual GovIT Expo: Letter from the Technical Chair
- Ulitzer News: Search vs New Media
- Publishing Synergy: Blog, Twitter and Ulitzer
- The Difference Between Web Hosting and Cloud Computing
- Cloud Computing Expo: Exclusive Q&A with Yahoo! SVP Cloud Computing
- GovIT Expo Highlights Cloud Computing
- The End of IT 1.0 As We Know It Has Begun
- Twitter, Linked In, Ning and Ulitzer: Easy Personal Branding Strategy
- Cloud CEOs, CTOs & SVPs to Speak at 4th International Cloud Computing Expo
- Practical Approaches for Optimizing Website Performance
- Is Cloud Computing Like Teenage Sex?
- 1st Annual GovIT Expo: Letter from the Technical Chair
- Ulitzer News: Search vs New Media
- Ruby-on-Rails Apps Get Cloud Lift
- Publishing Synergy: Blog, Twitter and Ulitzer
- The Difference Between Web Hosting and Cloud Computing
- Cloud Computing Expo: Exclusive Q&A with Yahoo! SVP Cloud Computing
- GovIT Expo Highlights Cloud Computing
- The i-Technology Right Stuff
- Linux.SYS-CON.com Exclusive: Linus Discloses *Real* Fathers of Linux
- After Ubuntu, Windows Looks Increasingly Bad, Increasingly Archaic, Increasingly Unfriendly
- Linus' Top Ten SCO Barbs
- A Closer Look at Damn Small Linux
- Netscape Co-Founder's 12 Reasons for Growth of Open Source
- Introducing "Cooperative Linux" - Linux for Windows, No Less
- *POINT - COUNTERPOINT SPECIAL* What's Wrong with the Open Source Community?
- Where Are RIA Technologies Headed in 2008?
- Linux.SYS-CON.com Exclusive: What Would UserLinux Look Like?

































