mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-08-14 08:52:22 +00:00
Update log2RAM
This commit is contained in:
parent
161c840136
commit
a98b087c5d
@ -686,11 +686,18 @@ install_log2ram_auto() {
|
|||||||
|
|
||||||
|
|
||||||
sed -i "s/^SIZE=.*/SIZE=$LOG2RAM_SIZE/" /etc/log2ram.conf
|
sed -i "s/^SIZE=.*/SIZE=$LOG2RAM_SIZE/" /etc/log2ram.conf
|
||||||
|
LOG2RAM_BIN="$(command -v log2ram || echo /usr/local/bin/log2ram)"
|
||||||
|
rm -f /etc/cron.daily/log2ram /etc/cron.weekly/log2ram /etc/cron.monthly/log2ram 2>/dev/null || true
|
||||||
rm -f /etc/cron.hourly/log2ram
|
rm -f /etc/cron.hourly/log2ram
|
||||||
echo "0 */$CRON_HOURS * * * root /usr/sbin/log2ram write" > /etc/cron.d/log2ram
|
|
||||||
msg_ok "$(translate "log2ram write scheduled every") $CRON_HOURS $(translate "hour(s)")"
|
{
|
||||||
|
echo 'MAILTO=""'
|
||||||
|
echo "0 */$CRON_HOURS * * * root $LOG2RAM_BIN write >/dev/null 2>&1"
|
||||||
|
} > /etc/cron.d/log2ram
|
||||||
|
|
||||||
|
chmod 0644 /etc/cron.d/log2ram
|
||||||
|
chown root:root /etc/cron.d/log2ram
|
||||||
|
msg_ok "$(translate "Log2RAM write scheduled every") $CRON_HOURS $(translate "hour(s)")"
|
||||||
|
|
||||||
|
|
||||||
cat << 'EOF' > /usr/local/bin/log2ram-check.sh
|
cat << 'EOF' > /usr/local/bin/log2ram-check.sh
|
||||||
@ -706,7 +713,12 @@ fi
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
chmod +x /usr/local/bin/log2ram-check.sh
|
chmod +x /usr/local/bin/log2ram-check.sh
|
||||||
echo "*/5 * * * * root /usr/local/bin/log2ram-check.sh" > /etc/cron.d/log2ram-auto-sync
|
{
|
||||||
|
echo 'MAILTO=""'
|
||||||
|
echo "*/5 * * * * root /usr/local/bin/log2ram-check.sh >/dev/null 2>&1"
|
||||||
|
} > /etc/cron.d/log2ram-auto-sync
|
||||||
|
chmod 0644 /etc/cron.d/log2ram-auto-sync
|
||||||
|
chown root:root /etc/cron.d/log2ram-auto-sync
|
||||||
msg_ok "$(translate "Auto-sync enabled when /var/log exceeds 90% of") $LOG2RAM_SIZE"
|
msg_ok "$(translate "Auto-sync enabled when /var/log exceeds 90% of") $LOG2RAM_SIZE"
|
||||||
|
|
||||||
register_tool "log2ram" true
|
register_tool "log2ram" true
|
||||||
|
@ -3002,18 +3002,18 @@ configure_log2ram() {
|
|||||||
"12" "$(translate "Every 12 hours")" OFF \
|
"12" "$(translate "Every 12 hours")" OFF \
|
||||||
3>&1 1>&2 2>&3) || return 0
|
3>&1 1>&2 2>&3) || return 0
|
||||||
|
|
||||||
# Activar auto-sync si se pasa del 90%
|
|
||||||
if whiptail --title "Log2RAM" --yesno "$(translate "Enable auto-sync if /var/log exceeds 90% of its size?")" 10 60; then
|
if whiptail --title "Log2RAM" --yesno "$(translate "Enable auto-sync if /var/log exceeds 90% of its size?")" 10 60; then
|
||||||
ENABLE_AUTOSYNC=true
|
ENABLE_AUTOSYNC=true
|
||||||
else
|
else
|
||||||
ENABLE_AUTOSYNC=false
|
ENABLE_AUTOSYNC=false
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Instalación
|
|
||||||
msg_info "$(translate "Installing Log2RAM from GitHub...")"
|
msg_info "$(translate "Installing Log2RAM from GitHub...")"
|
||||||
rm -rf /tmp/log2ram
|
rm -rf /tmp/log2ram
|
||||||
|
|
||||||
# Ensure git is available
|
|
||||||
if ! command -v git >/dev/null 2>&1; then
|
if ! command -v git >/dev/null 2>&1; then
|
||||||
msg_info "$(translate "Installing required package: git")"
|
msg_info "$(translate "Installing required package: git")"
|
||||||
apt-get update -qq >/dev/null 2>&1
|
apt-get update -qq >/dev/null 2>&1
|
||||||
@ -3031,13 +3031,22 @@ configure_log2ram() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Aplicar configuración
|
|
||||||
sed -i "s/^SIZE=.*/SIZE=$LOG2RAM_SIZE/" /etc/log2ram.conf
|
sed -i "s/^SIZE=.*/SIZE=$LOG2RAM_SIZE/" /etc/log2ram.conf
|
||||||
|
LOG2RAM_BIN="$(command -v log2ram || echo /usr/local/bin/log2ram)"
|
||||||
|
rm -f /etc/cron.daily/log2ram /etc/cron.weekly/log2ram /etc/cron.monthly/log2ram 2>/dev/null || true
|
||||||
rm -f /etc/cron.hourly/log2ram
|
rm -f /etc/cron.hourly/log2ram
|
||||||
echo "0 */$CRON_HOURS * * * root /usr/sbin/log2ram write" > /etc/cron.d/log2ram
|
|
||||||
|
{
|
||||||
|
echo 'MAILTO=""'
|
||||||
|
echo "0 */$CRON_HOURS * * * root $LOG2RAM_BIN write >/dev/null 2>&1"
|
||||||
|
} > /etc/cron.d/log2ram
|
||||||
|
|
||||||
|
chmod 0644 /etc/cron.d/log2ram
|
||||||
|
chown root:root /etc/cron.d/log2ram
|
||||||
msg_ok "$(translate "Log2RAM write scheduled every") $CRON_HOURS $(translate "hour(s)")"
|
msg_ok "$(translate "Log2RAM write scheduled every") $CRON_HOURS $(translate "hour(s)")"
|
||||||
|
|
||||||
# Auto-sync
|
|
||||||
if [[ "$ENABLE_AUTOSYNC" == true ]]; then
|
if [[ "$ENABLE_AUTOSYNC" == true ]]; then
|
||||||
cat << 'EOF' > /usr/local/bin/log2ram-check.sh
|
cat << 'EOF' > /usr/local/bin/log2ram-check.sh
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
@ -3050,7 +3059,14 @@ if (( USED_KB > THRESHOLD )); then
|
|||||||
fi
|
fi
|
||||||
EOF
|
EOF
|
||||||
chmod +x /usr/local/bin/log2ram-check.sh
|
chmod +x /usr/local/bin/log2ram-check.sh
|
||||||
echo "*/5 * * * * root /usr/local/bin/log2ram-check.sh" > /etc/cron.d/log2ram-auto-sync
|
|
||||||
|
{
|
||||||
|
echo 'MAILTO=""'
|
||||||
|
echo "*/5 * * * * root /usr/local/bin/log2ram-check.sh >/dev/null 2>&1"
|
||||||
|
} > /etc/cron.d/log2ram-auto-sync
|
||||||
|
chmod 0644 /etc/cron.d/log2ram-auto-sync
|
||||||
|
chown root:root /etc/cron.d/log2ram-auto-sync
|
||||||
|
|
||||||
msg_ok "$(translate "Auto-sync enabled when /var/log exceeds 90% of") $LOG2RAM_SIZE"
|
msg_ok "$(translate "Auto-sync enabled when /var/log exceeds 90% of") $LOG2RAM_SIZE"
|
||||||
else
|
else
|
||||||
rm -f /usr/local/bin/log2ram-check.sh /etc/cron.d/log2ram-auto-sync
|
rm -f /usr/local/bin/log2ram-check.sh /etc/cron.d/log2ram-auto-sync
|
||||||
|
Loading…
x
Reference in New Issue
Block a user