correct ipfs restart for xbian

This commit is contained in:
qo-op 2021-07-10 13:22:49 +02:00
parent bb870496ce
commit c0ab229794
2 changed files with 8 additions and 5 deletions

View File

@ -20,11 +20,12 @@ source $HOME/.profile
#### CONTROL STATION IPFS DAEMON
IPFSNODEID=$(ipfs --timeout=10s id -f='<id>\n')
[[ ! $IPFSNODEID ]] && echo "IPFS NOT RUNNING" && [[ -f /etc/sudoers.d/systemctl ]] && sudo systemctl restart ipfs && exit 1
[[ ! $IPFSNODEID && -f /etc/sudoers.d/systemctl ]] && echo "IPFS NOT RUNNING" && sudo systemctl restart ipfs && exit 1
[[ ! $IPFSNODEID && "${USER}" == "xbian" ]] && echo "IPFS NOT RUNNING" && sudo service ipfs restart && exit 1
## 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)
if [[ ! ${YOU} ]]; then
[[ -f /etc/sudoers.d/systemctl ]] && sudo systemctl restart ipfs
[[ "${USER}" == "xbian" ]] && sudo service ipfs restart || sudo systemctl restart ipfs
echo "ERROR! ipfs daemon was not running. RELAUNCHING."
exit 1
fi
@ -214,7 +215,8 @@ fi
# REFRESHing MEDIAKEY / ZenTAG nano DHTs => Zen File ECONOMY wallet cycle
if [[ "$timebar" == "12:12" || "$timebar" == "00:12" || "$timebar" == "03:03" || $(($runtime % 720)) == 0 || $runtime == 12 ]]; then
# Every 12h runtime restarting IPFS daemon
[[ "$timebar" == "03:03" ]] && [[ -f /etc/sudoers.d/systemctl || "$USER" == "xbian" ]] && sudo systemctl restart ipfs && exit 0
[[ "$timebar" == "03:03" ]] && [[ -f /etc/sudoers.d/systemctl ]] && sudo systemctl restart ipfs && exit 0
[[ "$timebar" == "03:03" ]] && [[ ${YOU} == "xbian" ]] && sudo service ipfs restart && exit 0
#### Refresh & publish MEDIAKEYs
$MY_PATH/zen/ipns_TAG_refresh.sh

View File

@ -10,7 +10,7 @@ ME="${0##*/}"
YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) && [[ ! $YOU ]] && echo "ipfs NOT RUNNING. EXIT" && exit 1
G1PUB=$(cat ~/.zen/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2) && [[ ! $G1PUB ]] && echo "ERREUR G1PUB. EXIT" && exit 1
IPFSNODEID=$(ipfs --timeout=5s id -f='<id>\n') && [[ "$IPFSNODEID" == "" ]] && echo 'ERROR missing IPFS Node id !! IPFS is not installed !?' && exit 1
IPFSNODEID=$(ipfs --timeout=5s id -f='<id>\n') || echo 'ERROR missing IPFS Node id !! IPFS is not installed !?' && exit 1
########################################################################
########################################################################
# This script is controling IPFS swarm
@ -28,8 +28,9 @@ IPFSNODEID=$(ipfs --timeout=5s id -f='<id>\n') && [[ "$IPFSNODEID" == "" ]] && e
#
for g1id in $(ls ~/.zen/ipfs/.$IPFSNODEID/FRIENDS);
do
[[ "$g1id" == "index.html" ]] && continue
ipfsnodeid=$(~/.zen/astrXbian/zen/tools/g1_to_ipfs.py $g1id)
[[ "$ipfsnodeid" == "index.html" ]] && continue
echo "OK Friend REFRESH /ipns/$ipfsnodeid INTO ~/.zen/ipfs_swarm/"
ipfs --timeout=20s get --output=/home/$YOU/.zen/ipfs_swarm/ /ipns/$ipfsnodeid
[[ -f /home/$YOU/.zen/ipfs_swarm/.$ipfsnodeid/_xbian.zuid ]] && cat /home/$YOU/.zen/ipfs_swarm/.$ipfsnodeid/_xbian.zuid || echo "NO ZUID"