In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
The purpose of this article is to share with you the content of the shell script on how to implement real-time streaming files in the background. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Copy the files under the bill folder to the bill1,bill2 folder according to a certain rule (file name parity).
Update bill1,bill2 processing progress label (update file.max)
File3 is the tag for the latest files in the bill directory, which is normally updated every minute (format: 20121016122100)
The code is 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"
Do
If [$file_max! = `cat file3`]; then
Echo "unequal, processing"
# judge file3 11-12 bits (parity)
Num1= `cut-c 11-12 file3`
# it will make an error if you encounter 08 when you do not add 1 inch to get the mold. (octal judgment? )
Num=$ ((10#$num1%2))
# num=$ (($num1%2))
# get the current file under 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 "give the latest value to file_max"
File_max= `cat file3`
Else
Echo "equal, do not handle, quit!"
# file_date= `cat $filename`
# exit 1
Fi
Echo "wait 10 seconds and judge next time."
Sleep 10
Done
Thank you for reading! This is the end of this article on "how to realize the shell script for real-time streaming files in the background". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.