Hello All,
Can someone tell me why the following script doesn't function as I thought
it might??
I'm sure the script is ugly, but aside from that, are there any *major*
flaws?
I mount a directory via NCPFS temporarily and then run this script. In
theory I hoped to look a the queues and if a file exist (*.q) then grab
the name of the file, and check to see whether or not it continues to
exist and sleep for a bit, then wake up a proceed through the script.
The script works fine so long as I "touch" a file in one of the
directories, execute the script, then let it email me and then manually
remove the file, it will then bail out and proceed normally. It
*doesn't* work properly if I allow the Novell server to add files to a
specified directory(queue) then execute the script and then allow the
print server to print the file in question and then remove it. Is it the
location of the file= line? The fact that I can manually remove the file
from the queue and have it work is what's puzzling me.
Any and all help would be greatly appreciated.
#!/bin/sh
topdir=/server1/queues
testq=$topdir/06010009.qdr
testqcode="TEST QUE"
sleeptime=600
counter=0
cd $testq
echo $testq
file=`ls *.q|head -n 1|gawk -F. '{ print $1"."$2}'` # set file equal to
# the first file we
# find in the queue
while [ -f "$file" ]; do
counter=$(($counter+1))
echo testq
echo "$file"
echo $counter
sleep $sleeptime
if [ "$counter" -eq 2 ]; then
echo "File exists in $ob"
echo ""|mail -s "$testqcode" [EMAIL PROTECTED]
counter=0
else
echo >/dev/null
fi
done
exit 0
...
...
...
blah....blah...blah...
Best Regards,
Tim
--
[EMAIL PROTECTED]
[EMAIL PROTECTED] (Home)
[EMAIL PROTECTED] (Work)
D I P C
The system that enables you to write distributed programs.......the
easy way!
http://wallybox.cei.net/dipc/