システムメンテナンス
- 2025/05/10 13:04
- カテゴリー:本サーバ関連
Webサーバのメンテナンスを実施
パッケージアップグレード
$ sudo apt update
$ sudo apt upgrade
$ shutdown -r now
ログローテート
$ sudo vi /etc/logrotate.conf
# see "man logrotate" for details
# global options do not affect preceding include directives
# rotate log files weekly
#weekly
monthly ← 変更
# keep 4 weeks worth of backlogs
#rotate 4
rotate 36 ← 変更
# create new (empty) log files after rotating old ones
create
# use date as a suffix of the rotated file
#dateext
# uncomment this if you want your log files compressed
compress
# packages drop log rotation information into this directory
include /etc/logrotate.d
# system-specific logs may also be configured here.
apache2の調整してなかったので設定
$ sudo vi /etc/logrotate.d/apache2
/var/log.hdd/apache2/*.log {
monthly #was daily
missingok
rotate 36 #was 14
compress
delaycompress
notifempty
create 640 root adm
sharedscripts
prerotate
if [ -d /etc/logrotate.d/httpd-prerotate ]; then
run-parts /etc/logrotate.d/httpd-prerotate
fi
endscript
postrotate
if pgrep -f ^/usr/sbin/apache2 > /dev/null; then
invoke-rc.d apache2 reload 2>&1 | logger -t apache2.logrotate
fi
endscript
}
syslogなど他はデフォルトで問題ない
UPSのチェック
バッテリー電圧の確認
問題ないようだ
CPU温度
ついでにCPU温度を表示するコマンドを作成
#!/bin/sh
#
for CORE in 0 1 2 3
do
if [ -r "/sys/class/thermal/thermal_zone$CORE" ]
then
echo "CPU-$CORE: \c"
echo "scale=1;`cat /sys/class/thermal/thermal_zone$CORE/temp` / 1000" | bc -l
fi
done
exit 0
4COREまで存在すれば表示