Skip to content

Latest commit

 

History

History
275 lines (199 loc) · 5.65 KB

File metadata and controls

275 lines (199 loc) · 5.65 KB

Quick Start Guide

Get up and running with the Shell Scripting Automation & Health Monitoring Toolkit in 5 minutes!

Prerequisites Check

Verify you have the required tools:

which tar gzip df du systemctl

If any are missing, install them using your package manager.

Installation

# Navigate to your home directory
cd ~

# Clone or extract the toolkit
cd Documents/Resume/shell-automation-toolkit

# Make scripts executable (if not already done)
chmod +x automation-toolkit.sh health-monitor.sh modules/*.sh

# Verify installation
./automation-toolkit.sh --help
./health-monitor.sh --help

First Steps

1. Test the Automation Toolkit

Display help menu:

./automation-toolkit.sh --help

Run a system health check:

./automation-toolkit.sh --health

Create a test backup:

mkdir -p ~/test-data
echo "Hello, World!" > ~/test-data/sample.txt
./automation-toolkit.sh --backup ~/test-data --verbose

List your backups:

./automation-toolkit.sh --list-backups

2. Test the Health Monitor

Run a single health check:

./health-monitor.sh --check --verbose

Monitor specific services:

./health-monitor.sh --service ssh --service cron --check

View alerts (if any):

./health-monitor.sh --list-alerts

Common Tasks

Daily Backups

Backup your important directories:

./automation-toolkit.sh --backup ~/Documents
./automation-toolkit.sh --backup ~/Projects

System Monitoring

Run comprehensive health check:

./automation-toolkit.sh --all-health

Service Monitoring

Monitor critical services with auto-healing:

sudo ./health-monitor.sh --monitor --auto-heal

Press Ctrl+C to stop continuous monitoring.

Cleanup Old Files

Remove files older than 30 days:

./automation-toolkit.sh --cleanup /tmp --verbose

Compress Directories

Compress large directories to save space:

./automation-toolkit.sh --compress ~/old-projects

Scheduling with Cron

Edit crontab:

crontab -e

Add automation tasks:

# Daily backup at 2 AM
0 2 * * * /home/yourusername/Documents/Resume/shell-automation-toolkit/automation-toolkit.sh --backup /home/yourusername/Documents

# Health check every hour
0 * * * * /home/yourusername/Documents/Resume/shell-automation-toolkit/health-monitor.sh --check

# Weekly cleanup of temp files
0 3 * * 0 /home/yourusername/Documents/Resume/shell-automation-toolkit/automation-toolkit.sh --cleanup /tmp

# Daily health report at 8 AM
0 8 * * * /home/yourusername/Documents/Resume/shell-automation-toolkit/automation-toolkit.sh --health

Note: Replace /home/yourusername/ with your actual home directory path.

Configuration

Customize Settings

Edit the configuration file:

nano config/config.conf

Key settings to adjust:

  • CPU_THRESHOLD - CPU alert threshold (default: 80%)
  • MEMORY_THRESHOLD - Memory alert threshold (default: 85%)
  • DISK_THRESHOLD - Disk alert threshold (default: 90%)
  • SELF_HEALING - Enable auto-restart of failed services (default: false)

Add Services to Monitor

Edit the services configuration:

nano config/services.conf

Add services (one per line):

ssh
cron
nginx
mysql
docker

Viewing Logs

All operations are logged for your reference:

# View automation toolkit log
tail -f logs/automation-toolkit.log

# View health monitor log
tail -f logs/health-monitor.log

# View alerts
tail -f logs/health_alerts.log

# View recovery attempts
cat logs/recovery.log

Troubleshooting

Permission Denied

If you get permission errors:

chmod +x automation-toolkit.sh health-monitor.sh modules/*.sh

Service Monitoring Requires Root

Some operations need root privileges:

sudo ./health-monitor.sh --check

Check Dependencies

Ensure all required commands are available:

./automation-toolkit.sh --help
# If you see "Missing required dependencies", install them using your package manager

Example Workflow

Here's a complete workflow to get you started:

# 1. Create test directory
mkdir -p ~/demo-project
echo "Important data" > ~/demo-project/data.txt

# 2. Backup the directory
./automation-toolkit.sh --backup ~/demo-project --verbose

# 3. Run system health check
./automation-toolkit.sh --all-health

# 4. Check service status
./health-monitor.sh --check --verbose

# 5. List all backups
./automation-toolkit.sh --list-backups

# 6. View logs
tail -20 logs/automation-toolkit.log

Next Steps

  1. Read the full README.md for detailed documentation
  2. Customize configuration in config/config.conf
  3. Schedule automated tasks using cron
  4. Explore all features using --help flags
  5. Integrate with your workflow based on your needs

Quick Command Reference

Command Description
--backup <path> Backup directory/file
--cleanup <path> Remove old files
--compress <path> Compress directory
--health System health report
--all-health Comprehensive health check
--list-backups Show all backups
--disk-usage <path> Show disk usage
--check Run health check once
--monitor Continuous monitoring
--auto-heal Enable auto-restart
--list-alerts Show alerts
--verbose Detailed output

Getting Help

For detailed information:

./automation-toolkit.sh --help
./health-monitor.sh --help

For full documentation, see README.md


Happy Automating! 🚀

If you encounter any issues or have questions, refer to the full README.md documentation or check the log files for detailed error messages.