I'll Have My People Call Your People
After all these steps are completed, we have pretty much all the pieces we need to continue with the actual phone book creation and build. If you haven't already done so, obtain the distribution for the phone book from the Salmar web site in the downloads section or from the Linux Journal FTP web site (see Resources).
The tar, gzipped distribution file is designed to extract into the standard Red Hat file structure for the Apache server, namely /home/httpd/html and /home/http/cgi-bin.
cd /home/httpd tar -xzvf /path_to/phonebook.tar.gz
The file list looks something like this:
html/sciphb/ html/sciphb/index.html html/sciphb/admin/ html/sciphb/admin/index.html cgi-bin/sciphb/ cgi-bin/sciphb/admin/ cgi-bin/sciphb/admin/getphoneinfo.pl cgi-bin/sciphb/admin/updphone.pl cgi-bin/sciphb/admin/getphone.pl cgi-bin/sciphb/admin/createphdbs.pl cgi-bin/sciphb/ugetphone.pl cgi-bin/sciphb/getnextkey.plIf you are running Apache from binaries built from the default source distribution, those directories will likely be /usr/local/apache/htdocs and /usr/local/apache/cgi-bin. If this is the case, you can extract the files to a temporary directory and move the sciphb directories to the appropriate cgi-bin and html/htdocs. Since there is always more than one way to do it, you could create symbolic links like this:
mkdir /home/httpd ln -s /usr/local/apache/htdocs /home/httpd/html ln -s /usr/local/apache/cgi-bin /home/httpd/cgi-binEverything will work fine from here, but you may want to verify the path to Perl. The .pl files in the cgi-bin/sciphb directory all call Perl from /usr/bin/perl. If necessary, change the first line of these files to reflect the actual path to your Perl binary.
Let this simmer for a few seconds, then change directory to the admin cgi scripts location:
There you will find a file called createphdbs.pl which (strangely enough) will create the databases necessary to use the phone book. This package is quite simple and, I believe, will provide the aspiring chef plenty of inspiration for further development. The scripts are small in number, but going through each script would take far too much space and take great advantage of the hospitality of this fine publication. I would, however, like to show you the PostgreSQL table creation for this on-line directory. Keep in mind that this is just a code morsel (Listing 1) and not the finished product. The first section shows the setup and initial calls using the Perl DBI in order to create the phone database. In particular, pay close attention to the line that begins with
$dbh = DBI->connect("dbi:Pg:dbname=$dbmain",The dbi:Pg identifies the database interface type (DBD); in this case, Pg stands for PostgreSQL.
Listing 2 is a portion of the actual database creation. Note the $dbh calls throughout. These are what make the DBI environment portable. Once having established the DBD (as in the connect statement above), there should be very little need to modify this code if you were to use another database.
Of course, there is more, but you will have to download the scripts to satisfy your appetite.
The phone book has two different interfaces: one for lookups only and another for both lookups and updates. You can, if you wish, use only the administration page if you are content to allow anyone in your organization to update the phone book information. Modifications of the index.html file to pull in the administration page require only a change to the actual page being pulled in. To access the default user interface, use this link: http://your_server/sciphb/.
The administration version of this page (which allows the adding of users, modification of records and deletes) can be accessed by going to this address: http://your_server/sciphb/admin/.
I recommend you keep the user and administration portions separate. Give a few specific users the responsibility of updating the phone book, and the information should continue to make sense.
You might also consider changing the available fields. For instance, the IN/OUT board aspect of the directory may not be for you. Perhaps you need another field. With the scripts provided and a little time, modifying this telephone directory to suit specific needs should be quite simple.
Once again, mes amis, it is closing time. The pleasure of having you here on a regular basis puts, how shall I say, “pressure” on my wine cellar. Ho, ho! I shall have to replenish, non? It is okay, mes amis. Chef Marcel is only kidding. There is always more wine, but the doors, they must close sometime. Until next time, enjoy that on-line telephone book. Remember—you are always welcome here at Chez Marcel. Bon Appétit!
Fast/Flexible Linux OS Recovery
On Demand Now
In this live one-hour webinar, learn how to enhance your existing backup strategies for complete disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible full-system recovery solution for UNIX and Linux systems.
Join Linux Journal's Shawn Powers and David Huffman, President/CEO, Storix, Inc.
Free to Linux Journal readers.Register Now!
- Download "Linux Management with Red Hat Satellite: Measuring Business Impact and ROI"
- ServersCheck's Thermal Imaging Camera Sensor
- The Italian Army Switches to LibreOffice
- Linux Mint 18
- Petros Koutoupis' RapidDisk
- Chris Birchall's Re-Engineering Legacy Software (Manning Publications)
- Oracle vs. Google: Round 2
- The FBI and the Mozilla Foundation Lock Horns over Known Security Hole
- Privacy and the New Math
Until recently, IBM’s Power Platform was looked upon as being the system that hosted IBM’s flavor of UNIX and proprietary operating system called IBM i. These servers often are found in medium-size businesses running ERP, CRM and financials for on-premise customers. By enabling the Power platform to run the Linux OS, IBM now has positioned Power to be the platform of choice for those already running Linux that are facing scalability issues, especially customers looking at analytics, big data or cloud computing.
￼Running Linux on IBM’s Power hardware offers some obvious benefits, including improved processing speed and memory bandwidth, inherent security, and simpler deployment and management. But if you look beyond the impressive architecture, you’ll also find an open ecosystem that has given rise to a strong, innovative community, as well as an inventory of system and network management applications that really help leverage the benefits offered by running Linux on Power.Get the Guide