This repository contains a python script that periodically runs a shell script to check service statuses and then displays the results via a local web server.
The ServiceStatus.py script operates in an infinite loop with a 2-second interval. In each cycle, it performs the following actions:
- Executes Health Check:
health-check.shusingsubprocess.call(). This script performs the actual service health checks and generates an output file in JSON format. - Serves Results: It then starts a local web server using the
live-servercommand to serve the contents of the current directory, allowing you to view the results from the health check script in a browser.
Before running this script, ensure you have the following installed and configured:
- Python 3: The script is written in Python.
health-check.sh: You must create an executable shell script namedhealth-check.shin the same directory asServiceStatus.py. This script should contain the logic for checking the status of your url domains.live-server: This is a Node.js package. You can install it globally using npm:npm install -g live-server
- Clone the repository.
- Create your custom
health-check.shfile in the root directory and make it executable:chmod +x health-check.sh
- Ensure all prerequisites are met.
- Run the Python script:
python3 ServiceStatus.py
The script will start, execute health-check.sh, and then launch live-server. This process will repeat every two seconds. You can view the output by navigating to the URL provided by live-server in your terminal.