Copy the files under the Bill folder to a certain rule (file name parity) under the Bill1,bill2 folder.
Update BILL1,BILL2 Processing Progress tab (update File.max)
File3 is the label for the current latest file in the bill directory and will normally be updated every minute (format: 20121016122100)
Copy Code code as follows:
#!/bin/bash
#for Wanggy 2012/10/16
Bill1=/infosms/bill1
Bill2=/infosms/bill2
file_max= ' Cat File3 '
Cd/infosms/bill
While:
echo "Start"
Todo
If [$file _max!= ' cat file3 '];then
echo "Unequal, handling"
#判断file3 11-12-bit (parity)
Num1= ' cut-c 11-12 file3 '
#如果不加10 # 08 can go wrong when taking a model. (8 in-system judgment?) )
num=$ ((10# $num 1%2))
#num =$ (($num 1%2))
#获取bill下当前文件 (Latest)
File_name=b ' Cat File3 '
echo "Latest file: $file _name"
Case $num in
1)
echo "Odd"
Cp-a $file _name. /bill1
Echo ' Cat file3 ' ... /bill1/file.max
0)
echo "Even"
Cp-a $file _name. /bill2
Echo ' Cat file3 ' ... /bill2/file.max
Esac
echo "to File_max to the newest value"
file_max= ' Cat File3 '
Else
echo "Equals, does not handle, exits!" "
# file_date= ' Cat $filename '
# exit 1
Fi
echo "Wait 10 seconds, next judgment ..."
Sleep 10
Done