Skip to content

meliodas113/sys-craft

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

1 Commit
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

SysCraft ๐Ÿ› ๏ธ

A collection of powerful shell scripts for system administration and management tasks.

๐Ÿš€ Quick Start

Want to use syscraft disk snapshot ~ from anywhere? Here's the fastest way:

# 1. Build and install the CLI
make install-local

# 2. That's it! Now you can use:
syscraft disk snapshot ~
syscraft env list
syscraft cron list

The CLI automatically finds your shell scripts and provides a unified interface to all tools.

Overview

SysCraft provides three essential tools for Unix/Linux system administrators:

  • DiskDiver: Track disk usage over time with snapshots and cleanup suggestions
  • EnvSculpt: Manage environment variables across shell configurations
  • CronCrafter: Visualize and edit cron jobs interactively

Scripts

๐Ÿ—‚๏ธ DiskDiver (diskdiver.sh)

Track disk usage changes over time with automated snapshots and cleanup recommendations.

Features:

  • Take disk usage snapshots at specified paths
  • View usage history with ASCII charts
  • Get cleanup suggestions for large/old files
  • Automated snapshots via cron

Usage:

./diskdiver.sh snapshot [path]    # Take snapshot (default: current dir)
./diskdiver.sh history [path]     # Show usage trends
./diskdiver.sh clean [date]       # Suggest cleanup from snapshot
./diskdiver.sh help               # Show help

Setup auto-snapshots:

# Add to crontab for hourly snapshots
crontab -e
# Add: 0 * * * * /path/to/diskdiver.sh snapshot /path/to/monitor

๐Ÿ”ง EnvSculpt (envsculpt.sh)

Centralized environment variable management across multiple shell configurations.

Features:

  • List all environment variables with sources
  • Add, edit, and delete variables
  • Sync changes to shell config files
  • Export to .env or JSON format

Usage:

./envsculpt.sh list               # List all env vars
./envsculpt.sh add [name] [value] # Add new variable
./envsculpt.sh edit [name]        # Edit existing variable
./envsculpt.sh delete [name]      # Delete variable
./envsculpt.sh sync               # Apply changes to shell configs
./envsculpt.sh export [format]    # Export to .env or JSON
./envsculpt.sh help               # Show help

โฐ CronCrafter (croncrafter.sh)

Interactive cron job management with validation and simulation.

Features:

  • List all cron jobs in table format
  • Edit jobs with interactive prompts
  • Validate cron syntax
  • Simulate job run times

Usage:

./croncrafter.sh list             # List all cron jobs
./croncrafter.sh edit [job_id]    # Edit specific job
./croncrafter.sh simulate [job_id] # Simulate next runs
./croncrafter.sh help             # Show help

Requirements

  • OS: Unix/Linux/macOS
  • Shell: Bash
  • Dependencies:
    • du (disk usage)
    • whiptail (optional, for better UI)
    • jq (optional, for JSON export)

Installation

Option 1: Direct Shell Script Usage

  1. Clone or download the scripts
  2. Make them executable:
    chmod +x *.sh
  3. Run from any directory or add to your PATH

Option 2: Go CLI (Recommended)

The Go CLI provides a unified interface to all three tools with better command organization and help.

  1. Install Go dependencies:

    make deps
  2. Build and install the CLI:

    make install-local

    This will install the CLI to ~/.local/bin and automatically add it to your PATH.

  3. Usage (from anywhere in your system):

    syscraft                    # Show main help
    syscraft disk              # DiskDiver commands
    syscraft env               # EnvSculpt commands
    syscraft cron              # CronCrafter commands

Alternative installation methods:

  • Quick build: ./build.sh (builds locally)
  • Global install: make install (requires sudo, installs to /usr/local/bin)
  • Manual PATH: If ~/.local/bin isn't in your PATH, add export PATH="$HOME/.local/bin:$PATH" to ~/.zshrc

Examples

Shell Script Usage

Monitor disk usage in your home directory:

./diskdiver.sh snapshot ~
./diskdiver.sh history ~

Manage environment variables:

./envsculpt.sh add JAVA_HOME /usr/lib/jvm/java-11
./envsculpt.sh sync

Edit a cron job:

./croncrafter.sh list
./croncrafter.sh edit 0

Go CLI Usage

DiskDiver operations:

syscraft disk snapshot ~          # Take snapshot of home directory
syscraft disk history ~           # Show usage history
syscraft disk clean               # Suggest cleanup

Environment variable management:

syscraft env list                 # List all variables
syscraft env add JAVA_HOME /usr/lib/jvm/java-11
syscraft env sync                 # Apply changes
syscraft env export json          # Export to JSON

Cron job management:

syscraft cron list                # List all cron jobs
syscraft cron edit 0              # Edit job with ID 0
syscraft cron simulate 0          # Simulate job runs

โœ… Current Status

The Go CLI is fully functional and tested:

  • โœ… CLI built and installed globally
  • โœ… All commands working from anywhere in the system
  • โœ… Scripts automatically discovered and executed
  • โœ… No more ./ prefix needed

You can now run syscraft disk snapshot ~ from any directory!

File Locations

  • DiskDiver snapshots: ~/.diskdiver/snapshots/
  • EnvSculpt config: ~/.envsculpt
  • CronCrafter: Uses system crontab

Contributing

Feel free to submit issues, feature requests, or pull requests to improve these tools.

License

Open source - use freely for personal and professional system administration tasks.


SysCraft: Crafting better system management, one script at a time. ๐Ÿš€

About

SysCraft ๐Ÿ› ๏ธ is a collection of powerful shell scripts and a unified CLI for system administration. It includes tools for disk usage tracking (DiskDiver), environment variable management (EnvSculpt), and cron job editing (CronCrafter). Cross-platform, script-first, and Go-powered, SysCraft simplifies everyday sysadmin tasks.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors