Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Monitoring a shell script

Status
Not open for further replies.

SDCSA

Programmer
May 8, 2003
22
US
Hello!!

I am relatively new to shell scripting.

I have a cgi which is a shell script: proj_web_apps.cgi

#!/usr/bin/ksh
. ../config/PROJ_ENV
# Limit the CPU time allowed for the process
ulimit -t $ULIMIT_CPU > /dev/null
$AWA_/bin/proj_web_apps

I would like to monitor who invoke this cgi and at what time. The user name and the ip address has to be appended to a text file. The name of the cgi is proj_web_apps.cgi. $REMOTE_ADDR is the cgi environment variable that tells who invoked the script.

So the text file should have:

CGI_NAME IPADDRESS TIMESTAMP

As requests come in, the above information keeps appending to the text file. I would greatly appreciate if you could provide me some help.

Thanks in advance.
 
Something like:
"$0 invoked by $REMOTE_ADDR at `date`" >> $logfile
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top