1753312 Members
5439 Online
108792 Solutions
New Discussion юеВ

scripting

 
SOLVED
Go to solution
John McDen
Regular Advisor

scripting

Hello Guru's,

How do I check for a particular file (dtdbache_*) in /tmp dir and if the file does not exist I need to run a script.

Please help...

Thanks for your help..
New to HP
4 REPLIES 4
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: scripting

FNAME=/tmp/myfile
if [ ! -f ${FNAME} ]
then
runmycommand
fi
If it ain't broke, I can fix that.
John McDen
Regular Advisor

Re: scripting

Hey Clay,

Thnx...

John
New to HP
Stefan Farrelly
Honored Contributor

Re: scripting


[ ! -f /tmp/dtdbache_* ] && echo runmycommand

Change the echo runmycommand to the actual command you want to run.
Im from Palmerston North, New Zealand, but somehow ended up in London...
MANOJ SRIVASTAVA
Honored Contributor

Re: scripting

Hi John


One more creative way

while true

do

export A='ls /tmp | grep dtdbache_ |wc -l'

if [$A = 1 ]

then

command

exit

fi

sleep ( interval )

done


Manoj Srivastava