From 7262cd68d7c6245755f3172d41656e5d5c81036d Mon Sep 17 00:00:00 2001 From: qo-op Date: Wed, 19 May 2021 15:14:09 +0200 Subject: [PATCH] isIPFSRunning? ipfs daemon restart --- cron_MINUTE.sh | 14 +++++++++----- zen/gchange_IPFS_swarm.sh | 10 ---------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/cron_MINUTE.sh b/cron_MINUTE.sh index 1b2a08a..66fac00 100755 --- a/cron_MINUTE.sh +++ b/cron_MINUTE.sh @@ -18,8 +18,12 @@ source $HOME/.profile [[ ! $(echo $PATH | grep "/usr/games") ]] && export PATH="$PATH:/usr/games" #### INIT STATION PARAMETERS -export YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) -[[ ! $YOU ]] && echo "ERREUR processus ipfs absent" && exit 1 +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 ]] && sudo systemctl restart ipfs + echo "ERROR! ipfs daemon is not running. EXIT" + exit 1 +fi [[ $IPFSNODEID ]] && export IPFSNODEID=$IPFSNODEID || export IPFSNODEID=$(ipfs id -f='\n') ######################################################################## @@ -150,13 +154,13 @@ fi # # ON Rpi/xbian files added in ~/astroport are monitored to activate "new_file_in_astroport.sh" # Transfert ~/astroport/*/files to IPFS and make Astroport/KODI indexes in IPNS -if [[ "$YOU" == "xbian" ]]; then - [[ ! -e /home/$YOU/astroport ]] && mkdir -p /home/$YOU/astroport +if [[ "$USER" == "xbian" ]]; then + [[ ! -e /home/$USER/astroport ]] && mkdir -p /home/$USER/astroport # VERIFY LAUNCH inotifywait ?! inotifywaitRunning=$(ps auxf --sort=+utime | grep -w inotifywait | grep -w astroport | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d ' ' -f 1) if [[ "$inotifywaitRunning" != "xbian" ]] then - /usr/bin/inotifywait -r -e close_write -m /home/$YOU/astroport | while read dir flags file; do $MY_PATH/zen/new_file_in_astroport.sh "$dir" "$file"; done >> /tmp/astroport.inotify.log 2>&1 & + /usr/bin/inotifywait -r -e close_write -m /home/$USER/astroport | while read dir flags file; do $MY_PATH/zen/new_file_in_astroport.sh "$dir" "$file"; done >> /tmp/astroport.inotify.log 2>&1 & fi fi diff --git a/zen/gchange_IPFS_swarm.sh b/zen/gchange_IPFS_swarm.sh index 87f571a..443859d 100755 --- a/zen/gchange_IPFS_swarm.sh +++ b/zen/gchange_IPFS_swarm.sh @@ -16,16 +16,6 @@ rm -f ~/.zen/A_my_swarm.txt && touch ~/.zen/A_my_swarm.txt rm -f ~/.zen/A_swarm_map.txt && touch ~/.zen/A_swarm_map.txt ######################################################################## -# ENVIRONEMENT DETECTION + IPFS ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_info -######################################################################## -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 ]] && sudo systemctl restart ipfs - echo "ERROR! ipfs daemon is not running. EXIT" - exit 1 -fi -######################################################################## - # Force Strict #swarm0 !!? # ipfs bootstrap rm --all liking_me_count=0