To find a file name


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting To find a file name
# 1  
Old 03-27-2009
MySQL To find a file name

Hi,

May I know is it possible, when a file named with the extension *.cgi runs in my box, I need a mail authentication...
# 2  
Old 03-27-2009
Quote:
Originally Posted by gsiva
Hi,

May I know is it possible, when a file named with the extension *.cgi runs in my box, I need a mail authentication...
go through the man page of ps command
like
Code:
 
if [ `ps -ef|grep *.cgi|wc -l` -gt 1 ] ; then
echo "CGI is running"
else
echo "not running"
fi

# 3  
Old 03-27-2009
Hi vidyadhar85, Thank you for your reply, but is it possible to set up with the email authentication when this *.cgi files runs in my box.
# 4  
Old 03-28-2009
I have set up in the cron the above script that will be running every 15 mins and will send an email notification to respective email id.
This is my cron
*/15 * * * * /bin/sh /root/find.sh | mail -s "CGI Script `date` `time`" <email id >

This scripts check for the *cgi file running in the box, if the *cgi file is running , it will send a message as "Cgi is running" , if not "Not running". rather than this type of option, i need as if *.cgi runs i need the mail notification if not i don't need the email notification.
# 5  
Old 03-30-2009
Hi,

Can you please help me on my request....
# 6  
Old 03-30-2009
you can put a && instaed if | in cron entry

if the out put of find.sh is 0 then it will send the mail
if its >0 no mail is sent.
You have the adapt the find.sh to give a output
# 7  
Old 04-01-2009
Hi,

What is the use of changing the cron from | to &&.. -> what will happen if we change to this...

also, I am not sure how to make changes to stop mail when the particular file is not running... I am not good in programming. Please help me on this ...
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Can you use find with ps or doing find excluding file in use

Hi, I am currently using the find below to remove old files. I am redirecting the listing to a file and then use a while-loop and do a rm cd ${directory} find . \( ! -name . -prune \) \( -type f -name "*.trc" -mtime +10 \) | sed 's#^./##' | sed "s#^#${directory}/#" 2>/dev/null | tee -a... (4 Replies)
Discussion started by: newbie_01
4 Replies

2. Shell Programming and Scripting

How to find a file with a specific pattern for current sysdate & upon find email the details?

I need assistance with following requirement, I am new to Unix. I want to do the following task but stuck with file creation date(sysdate) Following is the requirement I need to create a script that will read the abc/xyz/klm folder and look for *.err files for that day’s date and then send an... (4 Replies)
Discussion started by: PreetArul
4 Replies

3. Shell Programming and Scripting

wanted to find both link file and ordinary file using single find command

find . -type fl o/p is only the ordinary file. where in it wont give the link files. (2 Replies)
Discussion started by: nikhil jain
2 Replies

4. Shell Programming and Scripting

Find multiple string in one file using find command

Hi, I want find multiple string in one file using find coomand. And keeping it in one variable.grep is not working. (5 Replies)
Discussion started by: vivek1489
5 Replies

5. Shell Programming and Scripting

How to use grep & find command to find references to a particular file

Hi all , I'm new to unix I have a checked project , there exists a file called xxx.config . now my task is to find all the files in the checked out project which references to this xxx.config file. how do i use grep or find command . (2 Replies)
Discussion started by: Gangam
2 Replies

6. Linux

Simplified find command to find multiple file types

Hi, I'm using the following command to find the multiple requierd file types and its working fine find . -name "*.pl" -o -name "*.pm" -o -name "*.sql" -o -name "*.so" -o -name "*.sh" -o -name "*.java" -o -name "*.class" -o -name "*.jar" -o -name "*.gz" -o -name "*.Z" -type f Though... (2 Replies)
Discussion started by: vickramshetty
2 Replies

7. UNIX for Dummies Questions & Answers

How to find a file whick is consuming larger disk space in file system

Hello, Can anybody please tell me the command to find out the filesystem or a file which is consuming larger disk space sing i want to find out the file and want to compress it please help me out any help would be appreciated (6 Replies)
Discussion started by: lokeshpashine
6 Replies

8. UNIX for Dummies Questions & Answers

how to find a file named vijay in a directory using find command

I need to find whether there is a file named vijay is there or not in folder named "opt" .I tried "ls *|grep vijay" but it showed permission problem. so i need to use find command (6 Replies)
Discussion started by: amirthraj_12
6 Replies

9. Shell Programming and Scripting

how to find a file in UNIX without find command?

given a start directory,a filename,how to find it? (3 Replies)
Discussion started by: bluo
3 Replies
Login or Register to Ask a Question