In addition to Weibo, there is also WeChat
Please pay attention

WeChat public account
Shulou
2025-10-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
* this script comes from Mujia.com, and the copyright belongs to the original author *
Purpose of the script: query the number of configuration entries for a configuration item (such as [mysqld]) in the Mysql configuration file my.cnf and output it.
The specific script is as follows:
# *
# Author: tomshen
# QQ: × × ×
# Date: 2019-10-14
# Description: The test script
# Copyright (C): 2019 All rights reserved
# *
# output the name of each configuration segment of the my.cnf configuration file, and the number of configuration items for each configuration segment
FILE_NAME=/etc/my.cnf
Function get_all_segment
{
# get all segments
Declare-a mysql_array=$ (sed-n'/ [. *] / p'$FILE_NAME | sed-e's / [/ / g' | sed-e's /] / / g')
For var1 in ${mysql_array [@]}
Do
Echo "$var1"
Done
Unset var1
Unset mysql_aeeay
}
Function count_items_in_segment
{
# get the number of lines of the configuration entry for each configuration segment
Items=$ (sed-n "/\ [$1\] /, /\ [. *] / p" $FILE_NAME | grep-v ^ # | grep-v ^ $| grep-v "\ [. *\]") index=0 for item in $items do index= `expr $index + 1`expr $index
}
Number=0
For segment in get_all_segment
Do
Number=expr $number + 1
Items_count=count_items_in_segment $segment
Echo "$number. Configuration items: $segment configuration entries: $items_count"
Done
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.