How Ubuntu cleans up memory regularly

Source: Internet
Author: User
Tags rsyslog

How Ubuntu cleans up memory regularly

1. Enter Su

2. Create cleancache.sh

#!/bin/bash# 每一小时清除一次缓存echo "开始清除缓存"sync;sync;sync #写入硬盘,防止数据丢失sleep 10 #延迟10秒echo 3 > /proc/sys/vm/drop_caches

3. Set the executable

4. Create a timer task to be the administrator's identity

  0 *  *   *   *     cd /home/jiqing/sh && ./cleanCache.sh

Executed once per hour.

This way your computer will not be used more and more.

How do I view cron logs?

This log needs to be opened first.

Into the configuration file,

Remove log comments from Cron

cron.*  /var/log/cron.log #将cron前面的注释符去掉

Restart Rsyslog

sudo  service rsyslog  

View Crontab Logs

tail -f /var/log/cron.log   

Log is a good thing, convenient debugging, easy to see the real situation of the system. Look at the problem through the data.

How Ubuntu cleans up memory regularly

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.