chore: clarify auto-update feature

This commit is contained in:
tigattack
2025-09-26 23:24:34 +01:00
parent be3fe52aea
commit c886b812d6
5 changed files with 62 additions and 62 deletions

View File

@@ -821,7 +821,7 @@ EOF
success "Update sent successfully"
echo "$response" | grep -o '"packagesProcessed":[0-9]*' | cut -d':' -f2 | xargs -I {} info "Processed {} packages"
# Check for auto-update instructions (look specifically in autoUpdate section)
# Check for PatchMon agent update instructions (this updates the agent script, not system packages)
if echo "$response" | grep -q '"autoUpdate":{'; then
local auto_update_section=$(echo "$response" | grep -o '"autoUpdate":{[^}]*}')
local should_update=$(echo "$auto_update_section" | grep -o '"shouldUpdate":true' | cut -d':' -f2)
@@ -830,15 +830,15 @@ EOF
local current_version=$(echo "$auto_update_section" | grep -o '"currentVersion":"[^"]*' | cut -d'"' -f4)
local update_message=$(echo "$auto_update_section" | grep -o '"message":"[^"]*' | cut -d'"' -f4)
info "Auto-update detected: $update_message"
info "PatchMon agent update detected: $update_message"
info "Current version: $current_version, Latest version: $latest_version"
# Automatically run update-agent command
info "Automatically updating agent to latest version..."
# Automatically run update-agent command to update the PatchMon agent script
info "Automatically updating PatchMon agent to latest version..."
if "$0" update-agent; then
success "Agent auto-update completed successfully"
success "PatchMon agent update completed successfully"
else
warning "Agent auto-update failed, but data was sent successfully"
warning "PatchMon agent update failed, but data was sent successfully"
fi
fi
fi

View File

@@ -158,8 +158,8 @@ else
warning "Initial package data failed, but agent is configured. You can run 'patchmon-agent.sh update' manually."
fi
# Setup crontab for automatic updates
info "⏰ Setting up automatic updates every $UPDATE_INTERVAL minutes..."
# Setup crontab for automatic package status updates
info "⏰ Setting up automatic package status update every $UPDATE_INTERVAL minutes..."
if [[ $UPDATE_INTERVAL -eq 60 ]]; then
# Hourly updates
echo "0 * * * * /usr/local/bin/patchmon-agent.sh update >/dev/null 2>&1" | crontab -
@@ -179,7 +179,7 @@ if [[ "$EXPECTED_VERSION" != "Unknown" ]]; then
fi
echo " • Config directory: /etc/patchmon/"
echo " • Credentials file: /etc/patchmon/credentials"
echo "Automatic updates: Every $UPDATE_INTERVAL minutes via crontab"
echo "Status updates: Every $UPDATE_INTERVAL minutes via crontab"
echo " • View logs: tail -f /var/log/patchmon-agent.log"
echo ""
echo "🔧 Manual commands:"