This is a Bash script for monitoring a server process and automatically restarting it in case of a failure. The script continuously checks the status of the process and sends notifications when it detects any issues.
- Install the
Celestia CLI
by downloading binary - Use the
celestia version
to make sure it is properly installed, you will get the below - Curl command-line tool install
- How to install CURL. use
sudo apt-get update
andsudo apt-get install curl
The script will log the status of the Celestia process and notify you through a webhook when it goes down or is relaunched. It includes customizable settings such as the wait time between status checks and the path to the Celestia command.
- Customize the script by editing the webhook URL and Celestia command to match your specific requirements. The webhook URL can be for services such as Discord or Telegram.
- Grant executable permission to the script by running the command
chmod +x celestia_monitor.sh
. - Execute the script by running the command
./celestia_monitor.sh
.
WEBHOOK_URL
: The URL of the webhook to send notifications to.CELESTIA_CMD
: The command to start the Celestia light node process.WAIT_TIME
: The time to waitin seconds
before checking the Celestia process status again.RELAUNCH_WAIT_TIME
: The time to waitin seconds
before attempting to relaunch Celestia after a failure.
The script defines configuration options including the webhook URL for notifications, the command to start the Celestia light node process, the wait time before checking the Celestia process status again, and the wait time before attempting to relaunch the process after a failure. The script continuously monitors the Celestia process and relaunches it if it is not running. It also sends a webhook message when the process stops or is relaunched. The script includes functions to clean up and initialize Celestia if needed.