diff --git a/cron_MINUTE.sh b/cron_MINUTE.sh index 9f62a61..35bd0ef 100755 --- a/cron_MINUTE.sh +++ b/cron_MINUTE.sh @@ -122,7 +122,7 @@ if [[ $(($minute % 15)) == 0 ]]; then isIPFSRunning=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d ' ' -f 1) if [[ ! $isIPFSRunning ]]; then - [[ -f /etc/sudoers.d/systemctl && $(cat ~/.zen/ipfs/.$IPFSNODEID/.switch) == 1 ]] && sudo systemctl restart ipfs + [[ -f /etc/sudoers.d/systemctl && -f ~/.zen/ipfs/.$IPFSNODEID/.switch ]] && sudo systemctl restart ipfs echo "ERROR! ipfs daemon is not running. EXIT" exit 1 fi @@ -256,6 +256,8 @@ echo ' fi -#if [[ "$timebar" == "05:05" ]]; then -# ~/.zen/astrXbian/zen/ipfs_SWARM_renew.sh & -#fi +if [[ "$timebar" == "04:05" ]]; then + ~/.zen/astrXbian/zen/ipfs_SWARM_renew.sh 3600 ## CUT IPFS FOR ONE HOUR + ## SWITCHING ON + echo "1" > ~/.zen/ipfs/.$IPFSNODEID/.switch +fi diff --git a/zen/ipfs_SWARM_renew.sh b/zen/ipfs_SWARM_renew.sh index 4e7d927..e1045ea 100755 --- a/zen/ipfs_SWARM_renew.sh +++ b/zen/ipfs_SWARM_renew.sh @@ -25,10 +25,10 @@ _|_| | __) __)\/\//--\| \| | renew echo "I am $IPFSNODEID RESTARTING ~/.zen/astrXbian/A_boostrap_nodes.txt" ## SWITCHING OFF -echo "0" > ~/.zen/ipfs/.$IPFSNODEID/.switch -~/.zen/astrXbian/zen/ipns_self_publish.sh +rm -f ~/.zen/ipfs/.$IPFSNODEID/.switch sudo systemctl stop ipfs +sleep 10 ## RESTORE BOOTSTRAP ipfs bootstrap rm --all @@ -38,16 +38,13 @@ do ipfs bootstrap add $bootnode done -## STAY CALM 20 + $1 sec -sleep 20 +## STOP FOR $1 sec [[ "$1" =~ ^[0-9]+$ ]] && sleep $1 -## SWITCHING ON -echo "1" > ~/.zen/ipfs/.$IPFSNODEID/.switch +## RESTART +sudo systemctl restart ipfs -sudo systemctl start ipfs - -sleep 20 +sleep 30 # REFRESH IPNS SELF PUBLISH ########################################################################