wait a howmany timeout before restarting ipfs
This commit is contained in:
parent
6e77095ff5
commit
09f5dae89a
|
@ -20,9 +20,17 @@ source $HOME/.profile
|
||||||
|
|
||||||
#### CONTROL STATION IPFS DAEMON
|
#### CONTROL STATION IPFS DAEMON
|
||||||
## timeout is fixing ipfs minimum response time, before considering stuck process
|
## timeout is fixing ipfs minimum response time, before considering stuck process
|
||||||
IPFSNODEID=$(ipfs --timeout=30s id -f='<id>\n')
|
IPFSNODEID=$(ipfs --timeout=20s id -f='<id>\n')
|
||||||
[[ ! $IPFSNODEID && -f /etc/sudoers.d/systemctl ]] && echo "IPFS NOT RUNNING $(date)" >> ~/.zen/restart.txt && sudo systemctl restart ipfs && exit 1
|
howmany=$(cat /tmp/ipfs.timeout)
|
||||||
[[ ! $IPFSNODEID && "${USER}" == "xbian" ]] && echo "IPFS NOT RUNNING" && sudo service ipfs restart && exit 1
|
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
|
||||||
|
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
|
## 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)
|
YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1)
|
||||||
if [[ ! ${YOU} ]]; then
|
if [[ ! ${YOU} ]]; then
|
||||||
|
|
Loading…
Reference in New Issue