Get the App
SLTechnology News&Howtos  ›  Development  › 

How to release the Shell script of CentOS system memory

Shulou Source: shulou.com Published: 2022-06-03 09:19:17 11月15日 Update

This article introduces the relevant knowledge of "how to release the Shell script in CentOS system memory". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Content of the script:

The code is as follows:

#! / bin/bash

# cache release:

# To free pagecache:

Sync

Sync

# echo 1 > / proc/sys/vm/drop_caches

# To free dentries and inodes:

# echo 2 > / proc/sys/vm/drop_caches

# To free pagecache, dentries and inodes:

Echo 3 > / proc/sys/vm/drop_caches

Use the system crontab to run automatically every day:

The code is as follows:

Crontab-e

Enter the following:

The code is as follows:

00 00 * / root/Cached.sh

Free memory at 0 o'clock every day, at which time you can modify the settings according to your needs.

When running. / Cached.sh, if you prompt an error: Permission denied permission problem, you can run:

The code is as follows:

Chmod + x .Cached.sh

This is the end of the content of "how to release the Shell script in CentOS system memory". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Code content memory system script run more knowledge practicality achievement next dilemma reality situation article time permission case tape website Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Xiaomi Shulou Information Apple Shulou Technology