isIPFSRunning? ipfs daemon restart

This commit is contained in:
qo-op 2021-05-19 15:14:09 +02:00
parent 577e220187
commit 7262cd68d7
2 changed files with 9 additions and 15 deletions

View File

@ -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='<id>\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

View File

@ -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