From 52b616fb96d704e1ce7f6c37b3aee9f8f9b9f027 Mon Sep 17 00:00:00 2001 From: fred Date: Wed, 22 Sep 2021 23:38:04 +0200 Subject: [PATCH] wait a howmany timeout before restarting ipfs --- cron_MINUTE.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cron_MINUTE.sh b/cron_MINUTE.sh index 7ad8a2d..0f6541a 100755 --- a/cron_MINUTE.sh +++ b/cron_MINUTE.sh @@ -26,18 +26,19 @@ if [[ ! $IPFSNODEID ]]; then ## wait a howmany timeout before restarting ipfs howmany=$((howmany + 1)) && echo $howmany > /tmp/ipfs.timeout [ $howmany -gt 3 ] && [[ -f /etc/sudoers.d/systemctl ]] && echo "IPFS NOT RUNNING $(date)" >> ~/.zen/restart.txt && rm /tmp/ipfs.timeout && sudo systemctl restart ipfs + [ $howmany -gt 3 ] && [[ "${USER}" == "xbian" ]] && echo "IPFS NOT RUNNING" && sudo service ipfs restart && exit 1 exit 1 else echo 0 > /tmp/ipfs.timeout fi -[ $howmany -gt 3 ] && [[ ! $IPFSNODEID && "${USER}" == "xbian" ]] && echo "IPFS NOT RUNNING" && sudo service ipfs restart && exit 1 + ## CONTROL IPFS IS RUNNING OR RESTART YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) if [[ ! ${YOU} ]]; then - # reduice water levels for swarm + # control water levels for swarm ipfs config --json Swarm.ConnMgr.LowWater 50 ipfs config --json Swarm.ConnMgr.HighWater 100 - [[ "${USER}" == "xbian" ]] && sudo service ipfs restart || sudo systemctl restart ipfs + [ $howmany -gt 3 ] && [[ "${USER}" == "xbian" ]] && sudo service ipfs restart || sudo systemctl restart ipfs echo "ERROR! ipfs daemon was not running. RELAUNCHING." exit 1 fi