Click here for "Error Codes for Commercial Air Conditioners".

Ubuntu22.04 Server : DiCE , Logwatch , Disk usage check

1. DiCE  Install

Whenever the global IP changes, which happens when the network is disconnected or the router is disconnected and rebooted, the dynamic DNS must be accessed to inform the user that the global IP has changed. DiCE does this automatically!

1. 1 Download and install Dice


# cd /usr/local/bin/
# wget   (--no-check-certificate)
# tar -xzvf DiCE.tar.gz
#cd /usr/local/bin/DiCE

②DiCE Settings
DiCE output characters are EUC and therefore garbled.
Install nkf to convert to UTF-8

# apt install nkf

#To run 32-bit software Dice on 64-bit OS

# apt install lib32stdc++6

③Start DiCE

# cd /usr/local/bin/DiCE
# ./diced | nkf -uw

1. 2 Add Event

This time, the DNS service is VALUEDOMAIN
There is no English version of DiCE, so it is written in Japanese

# ./diced | nkf -uw
: add
><ユーザー名>  ←VALUEDOMAINに登録したユーザー名
><passwd>  ←VALUEDOMAINにログインするパスワード
実行する頻度を指定してください (番号入力)
(0)1回のみ (1)1日1回 (2)1週間に1回 (3)1ヵ月に1回
(4)その他の周期 (5)IPアドレス変化時 (6)起動時
(0)7日毎 (1)14日毎 (2)21日毎 (3)28日毎
(4)35日毎 (5)56日毎 (6)84日毎
このイベントを有効にしますか? (Y/N)
イベントを保存しますか? (Y/N)

1. 3 Event Confirmation

: list
(No.)   (イベント名)     (スケジュール)         (次回予定)
0 *      xxxxxxxxx   IPアドレス変化時 (7日毎)   07/29 06:27ー
:ex 0
+ 7/22 6:33 にddns_valuedomainが実行されました

1. 4 Automatic execution of Dice

Start the DiCE daemon

# /usr/local/bin/DiCE/diced -d -l
=-=-=- DiCE DynamicDNS Client -=-=-=
Version 0.19 for Japanese
Copyright(c) 2001 sarad# DiCE Daemon Started !!

Check if it is activated

# ps aux | grep diced
root   2207   2.7   0.0   7712   124 ?   Ss   22:32   0:01   /usr/local/bin/DiCE/diced -d -l

Set to start automatically

# vi /etc/rc.local
/usr/local/bin/DiCE/diced -d -l ←add
If /etc/rc.local is missing
Become systemd and write a script to register the program you want to run at startup as a service.
In the case of Ubuntu, if you write /etc/rc.local as root and set up the execution bit, it will be automatically executed by a service called rc-local.
Create New
# vi /etc/rc.local
/usr/sbin/ethtool -s eno1 wol g
※ eno1
is the name of their network interface (check with # ip addr)
# chmod 700 /etc/rc.local

2. Introduce disk usage check script

2.1 Create Script

# cd /opt/script/
# vi
Contents of


#Designation of e-mail address to be notified
MAIL="<your mailaddress> "

DVAL=`/bin/df / | /usr/bin/tail -1 | /bin/sed 's/^.* \([0-9]*\)%.*$/\1/'`

if [ $DVAL -gt 80 ]; then
echo "Disk usage alert: $DVAL %" | mail -s "Disk Space Alert in `hostname`" $MAIL

# chmod 700

2.2 Execution check

①Check current utilization

# df -h

The following appears

Filesystem                                        Size    Used    Avail    Use%   Mounted on
tmpfs                                              390M    1.6M   388M     1%    /run
/dev/mapper/ubuntu--vg-ubuntu--lv  9.8G     4.9G    4.4G   53%    /
tmpfs                                               1.9G         0     1.9G     0%   /dev/shm
tmpfs                                               5.0M         0     5.0M     0%  /run/lock
/dev/sda2                                         1.8G    125M    1.5G     8%  /boot
tmpfs                                               390M     4.0K   390M     1%  /run/user/1000

②Create a dummy file (in the example, it is called "dummyfile" and is about 4G) so that the utilization is 80% or more.

# dd if=/dev/zero of=dummyfile bs=1M count=4000


# df -h

Run it and make sure it is above 80%.

④Run disk space check script

# /opt/script/

You will receive an e-mail to the e-mail address you have set up with the body of the message as "Disk usage alert : 95%".

⑤Delete the "dummyfile" you created.

# rm dummyfile

⑥Periodic Execution Setting

# crontab -e
30 2 * * * /opt/script/

3. Log analysis tool logwatch installed

3.1 Install

# apt -y install logwatch

3.2 Edit logwatch configuration file

①Copy the default configuration file

# cp /usr/share/logwatch/default.conf/logwatch.conf /etc/logwatch/conf/

②Change the destination of your email, etc.

# vi /etc/logwatch/conf/logwatch.conf
# Line 52
MailTo =<your mailaddress> # < = Mailing address
# Line 84
Detail = High

3.3 Creating Directories

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

# mkdir /var/cache/logwatch

3.4 operation check

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

# /etc/cron.daily/00logwatch