updating things
All checks were successful
Check scripts syntax / check-scripts-syntax (push) Successful in 35s
All checks were successful
Check scripts syntax / check-scripts-syntax (push) Successful in 35s
This commit is contained in:
28
clean.sh
28
clean.sh
@@ -1,20 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
# System Cleanup and Maintenance Script
|
||||
#
|
||||
# Description: Comprehensive system cleanup for Docker containers and Linux systems
|
||||
# Features:
|
||||
# - Docker resource cleanup (images, containers, volumes, networks)
|
||||
# - Package manager cache cleanup (APK/APT)
|
||||
# - System cache and temporary file cleanup
|
||||
# - Log rotation and cleanup
|
||||
# - Memory cache optimization
|
||||
# - Journal cleanup (systemd)
|
||||
# - Thumbnail and user cache cleanup
|
||||
# Author: ivanch
|
||||
# Version: 2.0
|
||||
|
||||
set -euo pipefail # Exit on error, undefined vars, and pipe failures
|
||||
set -euo pipefail
|
||||
|
||||
#==============================================================================
|
||||
# CONFIGURATION
|
||||
@@ -35,9 +23,6 @@ readonly JOURNAL_RETENTION_DAYS=7
|
||||
readonly TEMP_DIRS=("/tmp" "/var/tmp")
|
||||
readonly CACHE_DIRS=("/var/cache" "/root/.cache")
|
||||
|
||||
# Auto-update configuration
|
||||
readonly AUTO_UPDATE_ENABLED=true
|
||||
|
||||
#==============================================================================
|
||||
# UTILITY FUNCTIONS
|
||||
#==============================================================================
|
||||
@@ -147,12 +132,6 @@ cleanup_docker() {
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Get initial Docker disk usage
|
||||
local docker_usage_before=""
|
||||
if docker system df >/dev/null 2>&1; then
|
||||
docker_usage_before=$(docker system df 2>/dev/null || echo "")
|
||||
fi
|
||||
|
||||
# Remove unused images
|
||||
log_info "Removing unused Docker images..."
|
||||
if docker image prune -af >/dev/null 2>&1; then
|
||||
@@ -192,11 +171,6 @@ cleanup_docker() {
|
||||
else
|
||||
log_warning "Docker system cleanup failed"
|
||||
fi
|
||||
|
||||
# Show space freed if possible
|
||||
if [[ -n "$docker_usage_before" ]] && docker system df >/dev/null 2>&1; then
|
||||
log_info "Docker cleanup completed"
|
||||
fi
|
||||
}
|
||||
|
||||
#==============================================================================
|
||||
|
Reference in New Issue
Block a user