Compare commits

...

1 Commits

Author SHA1 Message Date
aeefe2e895
feat: add nginx log rotation configuration 2025-07-28 17:28:21 +08:00

View File

@ -462,6 +462,21 @@ configure_node_exporter() {
fi
}
configure_nginx_log() {
[ $offline -eq 1 ] && return
[ "$(uname)" = "Darwin" ] && return
! command_exists nginx && return
[ ! -f /etc/logrotate.d/nginx ] && return
[ -z "$(grep 'daily' /etc/logrotate.d/nginx)" ] && return
if confirm_action "要配置 nginx 日志轮转修改为每周吗?" "N"; then
# 修改 /etc/logrotate.d/nginx 文件,替换 daily 为 weekly
sudo sed -i 's/daily/weekly/' /etc/logrotate.d/nginx
# 重新加载 logrotate 配置
sudo logrotate -f /etc/logrotate.d/nginx
fi
}
# configure_nodejs() {
# [ -f /usr/local/bin/node ] && return
# [ $offline -eq 1 ] && return
@ -562,3 +577,4 @@ configure_bootinfo
configure_oomkiller
# configure_swap
configure_node_exporter
configure_nginx_log