Skip to content

alexmllo/sysadmin-helper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

sysadmin-helper

Overview

sysadmin-helper is a CLI tool written in Bash for Linux system maintenance. It provides functions for:

  • Monitoring: Checking CPU, memory, and disk usage.
  • Logs: Rotating and analyzing log files.
  • Backup: Creating and restoring backups of important directories.
  • Maintenance: Performing system updates and cleaning up temporary files.

Setup

  1. Clone the repository:

    git clone https://github.com/alexmllo/sysadmin-helper.git
    cd sysadmin-helper
  2. Make the main script executable:

    chmod +x bin/sysadmin-helper.sh
  3. Configure your environment:

    Edit conf/sysadmin-helper.conf to set your desired thresholds, log file locations, backup directories, and package manager.

  4. Run the help command:

    ./bin/sysadmin-helper.sh help

Usage

Use one of the subcommands to execute a specific task:

Monitor System Health

Display CPU, memory, and disk usage metrics:

./bin/sysadmin-helper.sh monitor

Manage Logs

  • Rotate Logs: Rotate and compress the log file:

    ./bin/sysadmin-helper.sh logs rotate
  • Analyze Logs: Analyze the log file for errors:

    ./bin/sysadmin-helper.sh logs analyze

Backup Operations

  • Create a Backup: Create a backup of the directories specified in the configuration:

    ./bin/sysadmin-helper.sh backup create
  • Restore a Backup: Restore from a specified backup file to a destination (default is root):

    ./bin/sysadmin-helper.sh backup restore /path/to/backup.tar.gz /destination/path

Perform Maintenance

Run routine maintenance tasks such as updating system packages and cleaning temporary files:

./bin/sysadmin-helper.sh maintain

Alternatively, run specific tasks:

./bin/sysadmin-helper.sh maintain update
./bin/sysadmin-helper.sh maintain cleanup

Configuration

The configuration file (conf/sysadmin-helper.conf) includes settings such as:

  • Thresholds for Monitoring:

    THRESHOLD_CPU=80
    THRESHOLD_MEM=80
    THRESHOLD_DISK=90
  • Log File Location:

    LOG_FILE="/var/log/sysadmin-helper.log"
  • Backup Settings:

    BACKUP_DIR="/tmp/sysadmin-backups"
    BACKUP_SOURCES="/etc,/var/log"
  • Maintenance Settings: Specify your package manager (e.g., apt, yum):

    PACKAGE_MANAGER="apt"

About

Basic CLI tool for Linux System Manager

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages