Solved

cgi command to call webpage on apache linux server

Posted on 2006-10-27
8
193 Views
Last Modified: 2013-12-25
Currently I have a cgi file (lets call it app.cgi) on my website that runs an application.  The contents of the app.cgi file look something like this:

PGM=../path/to/app/appname;export PGM

Well the appname is currently under construction and I have a lot of pages that still point to this app.cgi file. I want this cgi file to call up a webpage instead which I have created that tells my users that the page is under contrction. This webpage is called construction.html.

What do I do to my cgi file (app.cgi) so that construction.html is called instead of the PGM?

Thanks!
0
Comment
Question by:bfilipek
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
8 Comments
 

Author Comment

by:bfilipek
ID: 17819252
This might help more:

The entire contents of the currenty cgi file looks like this (between the = signs):
=========================
#!/bin/bash

PGM=../path/to/app/appname;export PGM
MEM=4096;export MEM
/bin/sh ./bwu.sh
=========================
0
 
LVL 48

Accepted Solution

by:
Tintin earned 500 total points
ID: 17830046
#!/bin/bash
cat <<EOF
Status: 302 Moved
Location: http://www.yoursite.com/construction.html

EOF

0
 

Author Comment

by:bfilipek
ID: 17833901
Perfect. Thank you.
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

Author Comment

by:bfilipek
ID: 17833928
One more question. I see you have the absolute path to the page. Is there a way I can use a relative path? For example:

Location: ../html/construction.html

I tried the above and couldnt get it to work. Thanks again.
0
 
LVL 48

Expert Comment

by:Tintin
ID: 17837211
HTTP redirects need to be an absolute URL.

Why do you want to use a relative path?
0
 

Author Comment

by:bfilipek
ID: 17838115
We have two websites that are clones of each other (one used for testing, one use for production). One is located at /var/www/testweb and one is at /var/www/prodweb. If I have an absolute path, I have to modify this CGI file each time I do a copy of the test site to the live one if changes are made. The relative path would prevent this.

Any ideas? If not I can just stick with your original suggestion. Thanks again.
0
 
LVL 48

Expert Comment

by:Tintin
ID: 17838662
To make it work for any site, do

#!/bin/bash
cat <<EOF
Status: 302 Moved
Location: http://$HTTP_HOST/construction.html

EOF
0
 

Author Comment

by:bfilipek
ID: 17842195
That worked, thank you very much Tintin.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This tutorial will give you a fast look what you can do with WhizBase. I expect you already know how to work with HTML at least, and that you understand the basics of the internet and how the internet works. WhizBase is a server-s…
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question