diff --git a/cron_MINUTE.sh b/cron_MINUTE.sh index 301b760..326a1f1 100755 --- a/cron_MINUTE.sh +++ b/cron_MINUTE.sh @@ -20,7 +20,13 @@ source $HOME/.profile #### INIT STATION PARAMETERS [[ $IPFSNODEID ]] && export IPFSNODEID=$IPFSNODEID || export IPFSNODEID=$(ipfs id -f='\n') - +## CONTROL IPFS IS RUNNING OR RESTART +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 && -f ~/.zen/ipfs/.$IPFSNODEID/.switch ]] && sudo systemctl restart ipfs + echo "ERROR! ipfs daemon was not running. RELAUNCHING." + exit 1 +fi ######################################################################## # CORRECT VSTREAM ASTROPORT SITE/ART REMOVED AFTER PLUGIN UPDATE [[ ! -f ~/.kodi/addons/plugin.video.vstream/resources/sites/astroport.py ]] && [[ -f ~/.zen/astroport.py ]] && cp -f ~/.zen/astroport.py ~/.kodi/addons/plugin.video.vstream/resources/sites/ @@ -139,14 +145,6 @@ if [[ $(($minute % 15)) == 0 ]]; then ## RESTORE index.html from /tmp/ipfsindex.html [[ -f /tmp/ipfsindex.html ]] && mv /tmp/ipfsindex.html ~/.zen/ipfs/index.html - ## CONTROL IPFS IS RUNNING OR RESTART - 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 && -f ~/.zen/ipfs/.$IPFSNODEID/.switch ]] && sudo systemctl restart ipfs - echo "ERROR! ipfs daemon was not running. RELAUNCHING." - exit 1 - fi - ## PING ALL MY FRIENDS echo "## FRIENDS IPFS PINGing" for g1pub in $(ls -t ~/.zen/ipfs/.$IPFSNODEID/FRIENDS/); do [[ $g1pub ]] && ipfs ping --timeout=7s -n 5 /ipfs/$(~/.zen/astrXbian/zen/tools/g1_to_ipfs.py $g1pub 2>/dev/null) 2>/dev/null; done