A comprehensive cron job management and monitoring system for Unix/macOS environments.
WrathOfCron is a powerful toolkit for managing, monitoring, and analyzing cron jobs across multiple machines. It combines centralized configuration management with real-time monitoring, alerting, and visual analytics.
- π Centralized Management: Manage cron jobs across multiple machines from a single Git repository
- π Real-time Monitoring: Track cron job execution with comprehensive statistics and analytics
- π Smart Alerting: Instant macOS & Linux notifications for failed cron jobs
- π Visual Dashboard: Web-based dashboard with interactive charts and heatmaps
- π Auto-sync: Automatic synchronization with version control
- π‘οΈ Safety First: Automatic backups and rollback capabilities
- Python 3.7+
- Git
- Homebrew (for macOS notifications)
-
Clone the Repository
git clone https://github.com/your-username/wrathofcron.git cd wrathofcron -
Install Python Packages
pip install -r requirements.txt
-
Install OS-Specific Notifiers
- macOS:
terminal-notifieris required for notifications.brew install terminal-notifier
- Linux:
notify-sendis required (usually pre-installed on modern desktops).
- macOS:
-
Set Up Directories
mkdir -p ~/logs ~/.cron_dash
-
Start the Monitoring Daemon To begin real-time monitoring, start the collector daemon:
./cron_collector_manager.sh start
-
Install as a Cron Job To ensure the collector runs on system startup, install it as a cron job:
./cron_collector_manager.sh install
-
View the Web Dashboard Access the web dashboard to see real-time analytics:
python cron_dash_web.py # Open http://localhost:5001 in your browser
The core data collection and analysis script.
| Flag | Description |
|---|---|
--parse-existing |
Parses all existing entries in ladder.jsonl from the beginning. |
--stats |
Displays current statistics and exits. |
--daemon |
Runs the collector as a background daemon. |
--check-interval N |
Sets the check interval in seconds (Default: 30). |
--db-path PATH |
Specifies a custom path for the SQLite database. |
--log-level LEVEL |
Sets the logging level (e.g., DEBUG, INFO, WARNING). |
A helper script to manage the cron_collector.py daemon.
| Command | Description |
|---|---|
start |
Starts the collector daemon. |
stop |
Stops the collector daemon. |
status |
Shows the current status and key statistics. |
restart |
Restarts the collector daemon. |
logs |
Tails the collector's log file. |
parse |
A shortcut for cron_collector.py --parse-existing. |
install |
Installs a cron job to start the collector on system reboot. |
Manages the synchronization of cron jobs across machines.
| Command | Description |
|---|---|
install |
Installs shared and machine-specific cron jobs from text files. |
sync |
Syncs the current crontab to the shared shared-crontab.txt file. |
show |
Displays the contents of the shared cron file. |
show-machine |
Displays the machine-specific cron jobs for the current host. |
show-current |
Shows the currently active crontab. |
status |
Provides a summary of shared, machine-specific, and active jobs. |
setup-auto-sync |
Creates a script to enable auto-syncing of cron jobs. |
The web dashboard provides a visual overview of your cron jobs.
You can configure the web dashboard and its authentication settings using these environment variables:
| Variable | Description | Default |
|---|---|---|
DEBUG |
Enables or disables Flask's debug mode. | false |
HOST |
The host address for the web server. | 0.0.0.0 |
PORT |
The port for the web server. | 5001 |
AUTH_USERNAME |
The username for basic authentication. | admin |
AUTH_PASSWORD |
The password for basic authentication. | password |
Example:
export AUTH_USERNAME=myuser
export AUTH_PASSWORD=securepassword
python cron_dash_web.pyThe cron_collector.py script is designed to run as a daemon to continuously monitor your cron jobs. The cron_collector_manager.sh script handles the daemon lifecycle.
- PID File: The daemon's process ID is stored in
~/.cron_dash/collector.pid. - Log File: Daemon logs are written to
~/.cron_dash/collector.log. - Graceful Shutdown: The daemon can be stopped gracefully using
./cron_collector_manager.sh stop, which sends aSIGTERMsignal.
This project uses pytest for testing.
-
Install Testing Dependencies
pip install pytest
-
Run Tests Execute
pytestin the root directory:pytest
The tests cover unit functionality of the
cron_collector.pyscript, including parsing, timestamp normalization, and database interactions.
wrathofcron/
βββ π Management Scripts
β βββ cron-manager.sh # Centralized cron job management
β βββ auto-cron-sync.sh # Auto-sync integration
βββ π Monitoring & Analytics
β βββ cron_collector.py # Data pipeline for job monitoring
β βββ cron_collector_manager.sh # Collector daemon management
β βββ cron_dash_tui.py # Terminal-based dashboard
β βββ cron_dash_web.py # Web-based dashboard
βββ βοΈ Configuration
β βββ shared-crontab.txt # Jobs that run on all machines
β βββ cron-jobs/ # Machine-specific job definitions
βββ π Documentation
βββ CRON_COLLECTOR_GUIDE.md # Detailed monitoring guide
βββ CRON_MANAGEMENT.md # Management system guide
βββ README_cron_dashboard.md # Web dashboard documentation
- Fork the repository.
- Create a feature branch:
git checkout -b feature-name - Make your changes and add tests.
- Commit your changes:
git commit -am 'Add new feature' - Push to the branch:
git push origin feature-name - Submit a pull request.
Last Updated: $(LC_ALL=C date)
- Core monitoring and management components are active
- Multiple script modifications in progress
- Testing framework integrated with pytest
- Web dashboard and TUI interfaces available
- Auto-sync functionality implemented
- Management Scripts: cron-manager.sh, auto-cron-sync.sh
- Monitoring: cron_collector.py, cron_collector_manager.sh
- Dashboards: cron_dash_web.py, cron_dash_tui.py
- Testing: test_cron_collector.py
- Configuration: shared-crontab.txt, .gitignore
- auto-cron-sync.sh
- cron-manager.sh
- cron_collector.py
- cron_collector_manager.sh
- cron_dash_tui.py
- cron_dash_web.py
- requirements.txt
- .gitignore
- .last-cron-check
- test_cron_collector.py
This project is licensed under the MIT License - see the LICENSE file for details.