shell执行需要手动输入Y/N的命令时怎么自动化
例如脚本里面执行mkfs.ext3,会回显提示信息Y/N。需要用户手工确认。但是我们想自动化自动执行。可以用如下方法:
echo y | mkfs.ext3 /dev/sda3 例如脚本里面执行mkfs.ext3,会回显提示信息Y/N。需要用户手工确认。但是我们想自动化自动执行。可以用如下方法:
echo y | mkfs.ext3 /dev/sda3 MySQL主从复制状态及数据一致性监测工具 percona-toolkit:
详情简介使用文章:
https://www.cnblogs.com/kevingrace/p/6261091.html
percona-toolkit工具介绍 percona-toolkit工具中最主要的三个组件分别是:
另外两个工具介绍:
配置生成工具:https://sc.toolnb.com/tools/mysqlslave.html
主从复制错误修复工具:https://github.com/hcymysql/pt-slave-repair
清理数据库中的统计信息和检测日志
注意:该操作会清除所有日志信息,且不可恢复
docker exec safeline-mgt cleanlogs雷池占用磁盘,如何清理空间(清理统计数据)
大流量情况下,统计数据比较占用存储空间,如果发现luigi文件空间占用过大
有些环境需要使用docker-compose的命令,自行替换即可:
其它常见问题及故障排查处理请参考官方文档:
https://docs.waf-ce.chaitin.cn/zh/%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98%E6%8E%92%E6%9F%A5
iopaint是一个开源的AI去水印的工具,可以本地部署
Install pytorch
If you want to run model on GPU, it is necessary to install the GPU version of PyTorch. Otherwise, you can skip this step.
For NVIDIA GPU users
pip3 install torch==2.1.2 torchvision==0.16.2 --index-url https://download.pytorch.org/whl/cu118For AMD GPU users, only works on linux, as pytorch is not yet supported on Windows with ROCm.
pip3 install torch==2.1.2 torchvision==0.16.2 --index-url https://download.pytorch.org/whl/rocm5.6Install IOPaint
pip3 install iopaint
**Start IOPaint server**iopaint start --model=lama --device=cpu --port=8080
IOPaint is now running at http://localhost:8080(opens in a new tab), you can open it in your browser to start using it.
You can see all command line arguments using iopaint start --help, and you can see more models and features in the models page.
**解决安装Failed building wheel for pillow**
解决error: command ‘x86_64-linux-gnu-gcc‘ failed with exit status 1apt-get install libjpeg-dev zlib1g-dev
sudo apt-get install python3.7-dev
sudo apt-get install build-essential python3-dev libssl-dev libffi-dev libxml2 libxml2-dev libxslt1-dev zlib1g-dev
对于做国内网站来说,我不希望国外蜘蛛来访问我的网站,这些垃圾流量多了之后,严重浪费服务器的带宽和资源。通过判断user agent,在nginx中禁用这些蜘蛛可以节省一些流量,也可以防止一些恶意的访问。
解决方案
修改nginx.conf,禁止网络爬虫的user_agent,返回403。
1、 进入nginx的配置目录,例如cd /usr/local/nginx/conf
2、添加agent_deny.conf配置文件 vim agent_deny.conf
#禁止Scrapy等爬虫工具的抓取 Baiduspider
if ($http_user_agent ~* "Scrapy|Sogou web spider") {
return 403;
}
#禁止指定UA及UA为空的访问
if ($http_user_agent ~ "Scrapy|SemrushBot|FeedDemon|JikeSpider|Indy Library|Alexa Toolbar|AskTbFXTV|AhrefsBot|CrawlDaddy|CoolpadWebkit|Java|Feedly|UniversalFeedParser|ApacheBench|Microsoft URL Control|Swiftbot|ZmEu|oBot|jaunty|Python-urllib|lightDeckReports Bot|YYSpider|DigExt|YisouSpider|HttpClient|MJ12bot|heritrix|EasouSpider|LinkpadBot|Ezooms|^$" )
{
return 403;
}
#禁止非GET|HEAD|POST方式的抓取
if ($request_method !~ ^(GET|HEAD|POST)$) {
return 403;
}
#添加针对特殊的user_agent的访问
if ($http_user_agent ~ "Mozilla/4.0\ \(compatible;\ MSIE\ 6.0;\ Windows\ NT\ 5.1;\ SV1;\ .NET\ CLR\ 1.1.4322;\ .NET\ CLR\ 2.0.50727\)") {
return 404;
}在server层的网站配置中include这个配置文件进来,nginx -t 测试配置格式是否通过,再重启nginx服务
然后测试一下
用curl命令模拟浏览器头信息, 设置是否成功,curl的-A 可以让我们随意指定自己这次访问所宣称的自己的浏览器信息
#curl -I -A “BaiduSpider” www.test.com
HTTP/1.1 200 OK
Server: nginx
Date: Mon, 09 Feb 2022 09:37:20 GMT
Content-Type: text/html; charset=UTF-8 Connection: keep-alive
Vary: Accept-Encoding
X-Powered-By: PHP/5.5.19 Vary: Accept-Encoding, Cookie
Cache-Control: max-age=3, must-revalidate
WP-Super-Cache: Served supercache file from PHP
#curl -I -A “JikeSpider” www.test.com
HTTP/1.1 403 Forbidden
Server: nginx Date: Mon, 09 Feb 2022 09:37:44 GMT
Content-Type: text/html
Content-Length: 162 Connection: keep-alivenginx通过判断User-Agent屏蔽蜘蛛访问网站就已经完成,可以根据实际情况对agent_deny.conf中的蜘蛛进行增加、删除或者修改。
2、网站根目录下增加Robots.txt,放在站点根目录下。
在http://tool.chinaz.com/robots/站点可以针对现在的搜索引擎按照想要的规则生成robots.txt文件。