惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
The GitHub Blog
The GitHub Blog
F
Fortinet All Blogs
Cloudbric
Cloudbric
P
Palo Alto Networks Blog
T
Threatpost
T
Tor Project blog
T
Tenable Blog
AWS News Blog
AWS News Blog
Project Zero
Project Zero
L
LangChain Blog
Cyberwarzone
Cyberwarzone
Engineering at Meta
Engineering at Meta
雷峰网
雷峰网
C
CERT Recently Published Vulnerability Notes
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Security Latest
Security Latest
云风的 BLOG
云风的 BLOG
I
Intezer
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
P
Proofpoint News Feed
A
Arctic Wolf
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Google DeepMind News
Google DeepMind News
V
Vulnerabilities – Threatpost
C
Cybersecurity and Infrastructure Security Agency CISA
MongoDB | Blog
MongoDB | Blog
aimingoo的专栏
aimingoo的专栏
K
Kaspersky official blog
Jina AI
Jina AI
N
News | PayPal Newsroom
T
The Blog of Author Tim Ferriss
D
DataBreaches.Net
A
About on SuperTechFans
博客园 - 三生石上(FineUI控件)
博客园 - 【当耐特】
Hugging Face - Blog
Hugging Face - Blog
Recorded Future
Recorded Future
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
S
Secure Thoughts
TaoSecurity Blog
TaoSecurity Blog
P
Privacy & Cybersecurity Law Blog
P
Proofpoint News Feed
MyScale Blog
MyScale Blog
IT之家
IT之家
Forbes - Security
Forbes - Security
The Hacker News
The Hacker News
Last Week in AI
Last Week in AI
T
Threat Research - Cisco Blogs
Y
Y Combinator Blog

轻语博客

QUX主题后台设置完整使用指南 QUX 主题内置短代码使用教程 WordPress 移除菜单代码中没必要的部分 什么是 LLMs.txt?它对SEO有用吗?WordPress 网站如何生成 LLMs.txt? QUX子主题模块化首页 Linux如何重启Redis?如何优化Redis性能? 2023奥维图源 免费谷歌地图 热门神器:ChatGPT在线,无需魔法开箱即用!最新接口高效稳定 WordPress 开发人员必备的 12 个工具 WP-China-Yes插件:将你的WordPress接入本土生态体系中 WordPress 6.2 引入 HTML API 修改HTML标签和属性
宝塔面板自动重启数据库服务的shell脚本代码
0 个人已赞 · 2023-06-04 · via 轻语博客

2023-06-04 分类:网站教程 阅读(2.12K) 评论(0) 扫描二维码 隐藏侧边

WordPress占用资源比较大,服务器偶尔会出现数据库停止运行的情况,下面是一个重启数据库shell脚本,添加到服务器的计划任务即可,每执行一次便会检查数据库进程是否运行,如发现停止运行则会重启数据库

前往计划任务 任务类型选择shell脚本  然后把下面内容复制到脚本内容,建议执行频次在5-10分钟比较好。

#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
pgrep -x mysqld &> /dev/null
if [ $? -ne 0 ]
then
/etc/init.d/mysqld start
exit
fi

阅读全文