In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Os:rhel6.8 2.6.32-642.el6.x86_64
Today, the ping test script of the redis database written in the test times made an error ". / redis_ping.sh: line 40: 09: value too great for base (error token is" 09 ")", asked du Niang, said that because the double bracket operator in shell will calculate the number starting with 0 as octal, so it will report an error, 09 is larger than the cardinality. The place where the double-bracketed operator is used in the script is where the date is processed in minutes and seconds, as follows:
Cur_date= `date "+% Y-%m-%d% H:%M:%S" `- get the formatting time
Cur_hour_m2=$ (($((${cur_date:11:2} + 0))% 2))-intercepts the string and adds it to 0 with a double parenthesis operator (to remove the placeholder 0, let,expr and so on are usually used to add 0), but contrary to one's wishes, the double parenthesis operator cannot be calculated as a decimal for a number starting with 0
Cur_min=$ ((${cur_date:14:2} + 0))-- intercept the string and add 0
Cur_sec=$ ((${cur_date:17:2} + 0))-- intercept the string and add 0
Modified to:
Cur_hour=$ (($(date +%-H)% 2))-Modulus 2, that is, the control is executed every 2 hours
Cur_min=$ (date +%-M)
Cur_sec=$ (date +%-S)
The idea of this script is to ping all the servers in the redis cluster every 3 seconds. If there is a problem, write an early warning message. If all are normal, then write an early warning message every 2 hours, which means that the heartbeat of the ping script is normal.
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.