Skip to content

Instantly share code, notes, and snippets.

@Snuffy2
Snuffy2 / autoheal.sh
Last active June 20, 2023 03:18
Combine Autoheal with Webhookd to restart Docker Compose containers respecting depends_on
#!/bin/bash
NOW=$(date +'%m/%d %I:%M:%S %P')
LOGFILE="/opt/scripts/autoheal.log"
echo "${NOW}:" | tee -a ${LOGFILE}
echo "-------------------------------------------------------------" | tee -a ${LOGFILE}
echo "Hook information: name=${hook_name}, id=${hook_id}, method=${hook_method}" | tee -a ${LOGFILE}
echo "Header parameter: user-agent=${user_agent}" | tee -a ${LOGFILE}
#echo "Script parameters: ${@}" | tee -a ${LOGFILE}