🤖 System Automation & Documentation
1. Bash Scripting: Log Cleaner
This script checks the system log, archives old files, and removes everything older than 30 days. Perfect for keeping your server clean.
#!/bin/bash
LOG_DIR="/var/log/myapp"
ARCHIVE_DIR="/var/log/myapp/archive"
# Create archive directory if it doesn't exist
mkdir -p "$ARCHIVE_DIR"
echo "Starting log maintenance..."
# Move logs older than 7 days to archive
find "$LOG_DIR" -name "*.log" -mtime +7 -exec mv {} "$ARCHIVE_DIR" \;
# Delete archived logs older than 30 days
find "$ARCHIVE_DIR" -name "*.log" -mtime +30 -delete
echo "Maintenance complete: $(date)"
2. Installation Procedure
Follow these steps to deploy the script locally:
