Created
April 17, 2024 07:04
-
-
Save llccing/b1171812ec61c0a274d8ed26b7f317ef to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# 确保脚本以 root 权限运行 | |
if [ "$EUID" -ne 0 ] | |
then echo "请以 root 权限运行" | |
exit | |
fi | |
# 同步磁盘数据,确保所有缓存数据写入磁盘 | |
echo "正在同步磁盘数据..." | |
sync | |
# 清理缓存 | |
echo "正在清理所有缓存..." | |
echo 3 > /proc/sys/vm/drop_caches | |
# 显示完成消息 | |
echo "缓存清理完成!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment