Visit Our UNIX and Linux User Community


cgi scripting help needed


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting cgi scripting help needed
# 1  
Old 07-22-2009
Data cgi scripting help needed

hi all,

i'm new to CGI scripting.

I want to compute memory utilisation,
so when i run free command in my cgi scipt,
if memory is utlised more than 70%.

i want to display in free command in html as red color
free
total used free shared buffers cached
Mem: 16438364 15484884 953480 0 392996 9730932
-/+ buffers/cache: 5360956 11077408
Swap: 8385920 91092 8294828
else
I want to show it in green color
free
total used free shared buffers cached
Mem: 16438364 15484884 953480 0 392996 9730932
-/+ buffers/cache: 5360956 11077408
Swap: 8385920 91092 8294828
# 2  
Old 07-22-2009
Here is some example template to make html, also how to use cgi variables = look env
Code:
#!/bin/ksh
cat <<EOF
Content-type: text/html

<html>
<body>
$QUERY_STRING
- all other values, look env variables
$(env)
<hr>
EOF

style="color:red;"
# make your calculation here
# then output
((value < 70 ))  && style="color:green;"

cat <<EOF
You can call cmd also<br />
Date: $( date '+%Y-%m-%d %H:%M:%S' ) <br />

<div style="$style">
free .
total used free shared buffers cached
$somevariable and  $var2 ...
Put your data here with variables
</div>

HERE is nice template method ex. using in cgi-scripts.
</body>
</html>
EOF


Previous Thread | Next Thread
Test Your Knowledge in Computers #626
Difficulty: Easy
False === 0.
True or False?

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Web Service in Perl CGI scripting

Hi, I have a requirement to write web service in Perl CGi scripting.The web service will be called by some external programs.Any help would be appreciated.Sample hello world program will be more helpful. Thanks, Liyakath Ali. (1 Reply)
Discussion started by: liyakathali
1 Replies

2. Shell Programming and Scripting

Perl CGI Scripting

Hi, My below cgi script works fine from the command line but not working from the web browser. #!/usr/bin/perl use File::Copy; use CGI; print "Content-type: text/html\n\n"; print "<html><head><title>LOGS"; print "</title></head>"; print "<body bgcolor=#95B9C7 link=black>"; ... (4 Replies)
Discussion started by: liyakathali
4 Replies

3. Shell Programming and Scripting

Help needed in scripting

Hi Guys, I need help in scripting out the below : this is a sample data i have in my file: jobname type 8:00:00 AM I need to remove the ":00" from the time field alone. Thanks in advance for all ur help (8 Replies)
Discussion started by: a12ka4
8 Replies

4. Homework & Coursework Questions

Scripting needed

Hi, My task is to check the file test.txt every 15 min from Mon-Fri 9:00AM - 6:00PM. We get this file from our mainframes, every 15 min it will update the same file. My task is to compare file timestamp with current system time stamp and check if the file is updated or not. If the file doesn't... (0 Replies)
Discussion started by: chinniforu2003
0 Replies

5. Shell Programming and Scripting

CGI scripting Error

I am trying to execute following program #!/usr/bin/perl -wT use CGI qw(:standard); print start_html("Hello world"); and getting an error (offline mode: enter name=value pairs on standard input) i am a beginner so please try to explain it as much as possible. ---------- Post updated... (4 Replies)
Discussion started by: bhavesh.sapra
4 Replies

6. Shell Programming and Scripting

Help needed with scripting.

Hello Friends, I am very new to scripting and currently have come across a situation where I need to create a UNIX script which would look for certain text in a file and then email me if it finds it. I am trying to trouble shoot an issue with our internet websites and I need to know when I... (1 Reply)
Discussion started by: mahive
1 Replies

7. Solaris

executing cgi programs in solaris(B89) needed urgent help,pls!

Hi all, I am trying to execute cgi scripts on solaris, but everytime i get a internal server error... The syntax of my .cgi script is correct as ive checked.. Steps i followed 1.started apache 2.The UNIX and Linux Forums - Learn UNIX and Linux from Experts (in opera) 3.places my cgi scripts... (7 Replies)
Discussion started by: wrapster
7 Replies

8. Shell Programming and Scripting

sh scripting! Help Needed

Hello fellas or ladies. I am new on this site and new to the unix operating system. I have been working with UNIX and i love it so far, i learned some stuff and most of the beneficiary command but I need help renaming all the files in my directory and doing them one by one is just tiring.... (1 Reply)
Discussion started by: keyboardkowboy
1 Replies

9. Shell Programming and Scripting

Writing CGI scripting using perl

Hi All, I am trying to do the following thing. I am entering name & email id & then in action i am calling a .cgi program that sends a email to the email id entered. I am facing a small problem, once i have entered the details , its printing the contents of .cgi file in browser. there is a... (7 Replies)
Discussion started by: alma
7 Replies

Featured Tech Videos