In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains "check IP format and mysql operation examples with Shell script". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "using Shell scripts to check IP format and mysql operation examples"!
It is also a part of cronjob, that is, in the scheduled tasks of Rails, the background runs interactively.
CheckIPAddress () {echo $1 | grep "^ [0-9]\ {1 else 3\}\. [0-9]\ {1 else 3\}\. [0-9]\ {1 Magne3\}\. [0-9]\ {1Magne3\} $" > / dev/null if [$? = 1]; then return 1 else a = `echo $1 | awk-F. '{print $1}' `b = `echo $1 | awk-F. '{print $2}' `c = `echo $1 | awk-F. '{print $3}' `d = `echo $1 | awk-F. '{print $4}' `# echo $a $b $c $d for loop in $a $b $c $d do if [$loop-ge] | | [$loop-lt 0]; then return 2 fi done fi} ConfigureDefaultRegion () {echo "Please input Region ip" ret=1 while [$ret! = 0] do read region_ip CheckIPAddress $region_ip ret=$? # echo $ret if [$ret=1] Then echo "Wrong IP address, please reinput Region IP:" fi done / usr/bin/mysql-u root realworx_production-e "update regions set ip='$region_ip' where id=1" 1 > / dev/null 2 > / dev/null if [$? = 0] Then / usr/bin/mysql-u root realworx_production-e "update config_params set val=1 where ident=55" 1 > / dev/null 2 > / dev/null echo "set'$region_ip' as Default and Admin Region IP" elseval= `/ usr/bin/mysql-u root realworx_production-e "select id from regions where ip='$region_ip'" | awk'{if ($1! = "id") print $1}'` / usr/bin/mysql-u root Realworx_production-e "update config_params set val='$val' where ident=55" 1 > / dev/null 2 > / dev/null region_name= `/ usr/bin/mysql-u root realworx_production-e "select name from regions where ip='$region_ip'" | awk'{if ($1! = "name") print $1} '`echo "IP already exists. So set'$region_name' as Admin Region. " Fi echo "Region Setting Successfull."} so far, I believe you have a deeper understanding of "checking IP format and mysql operation examples with Shell scripts". You might as well do it in practice! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.