Frequent Advisor
Re: Need Script to monitor file transfer has occurred
Test directory:
root in /home/rowec/tevo
sfitevo1 850 #ll
total 41
drwxr-xr-x 2 root system 512 Aug 19 13:35 .
drwxrwxrwx 3 rowec system 512 Aug 19 13:24 ..
-rw-r--r-- 1 root system 1961 Aug 19 13:36 20040819133526.udf204.gwn
-rw-r--r-- 1 root system 1962 Aug 19 13:36 20040819133530.udf204.gwn
-rw-r--r-- 1 root system 1843 Aug 19 13:36 20040819133533.udf204.gwn
-rw-r--r-- 1 root system 1961 Aug 19 13:36 20040819133536.udf204.gwn
-rw-r--r-- 1 root system 1790 Aug 19 13:36 20040819133539.udf204.gwn
-rw-r--r-- 1 root system 2262 Aug 19 13:36 20040819133542.udf204.gwn
-rw-r--r-- 1 root system 2713 Aug 19 13:36 20040819133545.udf204.gwn
-rw-r--r-- 1 root system 1984 Aug 19 13:36 20040819133550.udf204.gwn
-rw-r--r-- 1 root system 1866 Aug 19 13:36 20040819133604.udf204.gwn


Result of running script:
sfitevo1 853 #sh -vx tevo2
#!/usr/bin/ksh
set -x
+ set -x

# Directory Path
DIR=/home/rowec/tevo
+ DIR=/home/rowec/tevo

for file in `ls $DIR`
do

min=`ll $file | awk '{ print $8 }' | cut -d : -f2`
org=`date +'%M'`

if [[ $min -gt `date +'%M'` ]]
then

# Make a alert or mail with $file info
# mailx
echo "files not moving"
fi
done
+ ls /home/rowec/tevo
+ + ll 20040819133526.udf204.gwn
+ awk { print $8 }
ls: 0653-341 The file 20040819133526.udf204.gwn does not exist.
+ cut -d : -f2
min=
+ + date +%M
org=36
+ date +%M
+ [[ -gt 36 ]]
+ + ll 20040819133530.udf204.gwn
+ awk { print $8 }
+ cut -d : -f2
ls: 0653-341 The file 20040819133530.udf204.gwn does not exist.
min=
+ + date +%M
org=36
+ date +%M
+ [[ -gt 36 ]]
+ + ll 20040819133533.udf204.gwn
+ awk { print $8 }
ls: 0653-341 The file 20040819133533.udf204.gwn does not exist.
+ cut -d : -f2
min=
+ + date +%M
org=36
+ date +%M
+ [[ -gt 36 ]]
+ + ll 20040819133536.udf204.gwn
+ awk { print $8 }
+ cut -d : -f2
ls: 0653-341 The file 20040819133536.udf204.gwn does not exist.
min=
+ + date +%M
org=36
+ date +%M
+ [[ -gt 36 ]]
+ + ll 20040819133539.udf204.gwn
+ awk { print $8 }
+ cut -d : -f2
ls: 0653-341 The file 20040819133539.udf204.gwn does not exist.
min=
+ + date +%M
org=36
+ date +%M
+ [[ -gt 36 ]]
+ + ll 20040819133542.udf204.gwn
+ awk { print $8 }
ls: 0653-341 The file 20040819133542.udf204.gwn does not exist.
+ cut -d : -f2
min=
+ + date +%M
org=36
+ date +%M
+ [[ -gt 36 ]]
+ + ll 20040819133545.udf204.gwn
+ awk { print $8 }
+ cut -d : -f2
ls: 0653-341 The file 20040819133545.udf204.gwn does not exist.
min=
+ + date +%M
org=36
+ date +%M
+ [[ -gt 36 ]]
+ + ll 20040819133550.udf204.gwn
+ awk { print $8 }
+ cut -d : -f2
ls: 0653-341 The file 20040819133550.udf204.gwn does not exist.
min=
+ + date +%M
org=36
+ date +%M
+ [[ -gt 36 ]]
+ + ll 20040819133604.udf204.gwn
+ awk { print $8 }
ls: 0653-341 The file 20040819133604.udf204.gwn does not exist.
+ cut -d : -f2
min=
+ + date +%M
org=36
+ date +%M
+ [[ -gt 36 ]]

root in /home/rowec
sfitevo1 854 #


Something is not quite right.




Take time to smell the roses.