Ubuntu Server23.04 ; disk usage check script , Logwatch

1. Introduce disk usage check script

1.1 Script Creation

Contents of disk_capacity_check.sh

1.2 Execution Confirmation

①Check current usage

It appears as follows

Create a dummy file so that it is 80% or more (in this case, create about 1G).

③again Confirmation

Confirmation that it is above 80%.

④Run disk space check script

You will receive an email to the email address you set up with the body of the message as "Disk usage alert: 87 %".

⑤Delete the "dummyfile" you created.

⑥Periodic Execution Setting

2. Log analysis tool Logwatch installed

2.1 Install logwatch

2.2 Edit logwatch configuration file

①Copy the default configuration file

②Change email address, etc.

2.3 Creating Directories

There is no directory used by the cache, so create one.

2.4 operation check

When logwatch is installed, cron is registered by default, so you will receive daily report emails.
If you want to check it immediately, do the following

Copied title and URL