LOW mode enable IPFS only during 20H12 sync time

This commit is contained in:
fred 2023-04-12 18:45:10 +02:00
parent a83f770933
commit 94cba1e6ed
3 changed files with 29 additions and 8 deletions

View File

@ -14,8 +14,13 @@ espeak "Ding" > /dev/null 2>&1
rm -Rf ~/.zen/tmp/*
## RESTART IPFS DAEMON
STOPPED=$(sudo systemctl status ipfs | grep disabled) ## IPFS DISABLED - START ONLY FOR SYNC -
# echo "$USER ALL=(ALL) NOPASSWD:/bin/systemctl" | (sudo su -c 'EDITOR="tee" visudo -f /etc/sudoers.d/systemctl')
[[ -s /etc/sudoers.d/systemctl ]] && sudo systemctl restart ipfs && sleep 5
if [[ $STOPPED != "" ]]; then
sudo systemctl start ipfs && sleep 10
else
sudo systemctl restart ipfs && sleep 10
fi
espeak "CODE git pull" > /dev/null 2>&1
@ -81,4 +86,7 @@ else
echo "systemd restart"
fi
## IPFS DISABLED : STOP IT
[[ $STOPPED != "" ]] && sleep 360 && sudo systemctl stop ipfs
exit 0

View File

@ -218,7 +218,7 @@ echo "#############################################"
espeak "Please create a player"
[[ $XDG_SESSION_TYPE == 'x11' ]] \
&& xdg-open "http://astroport.localhost:1234" \
|| ~/.zen/Astroport.ONE/comand.sh
|| ~/.zen/Astroport.ONE/command.sh
else

View File

@ -33,17 +33,19 @@ cat ~/.zen/GPS 2>/dev/null && echo " TODO calibrate 20H12 with GPS"
if [[ ! $crontest ]]; then
## HEADER
[[ $1 == "OFF" ]] && exit 0
[[ $1 == "OFF" || ]] && exit 0
[[ ! $(cat /tmp/mycron | grep -F 'SHELL') ]] && echo "SHELL=/bin/bash" > /tmp/newcron
[[ ! $(cat /tmp/mycron | grep -F 'PATH') ]] && echo "PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin" >> /tmp/newcron
cat /tmp/mycron >> /tmp/newcron
# ADD 20h12.process.sh line
echo "12 20 * * * /bin/bash $MY_PATH/../20h12.process.sh > /tmp/20h12.log 2>&1" >> /tmp/newcron
crontab /tmp/newcron
sudo systemctl enable ipfs
[[ $1 != "LOW" ]] && sudo systemctl enable ipfs
sudo systemctl enable astroport
sudo systemctl start ipfs
sudo systemctl enable g1billet
[[ $1 != "LOW" ]] && sudo systemctl start ipfs
sudo systemctl start astroport
sudo systemctl start g1billet
echo "ASTROPORT is ON"
else
@ -56,9 +58,20 @@ else
crontab /tmp/newcron
sudo systemctl stop ipfs
sudo systemctl disable ipfs
sudo systemctl stop astroport
sudo systemctl disable astroport
echo "ASTROPORT is OFF"
echo "ASTROPORT IPFS is OFF (20H12 START ONLY)"
if [[ $1 == "LOW" ]]; then
echo "KEEPING 20H12 CRON ACTIVATED"
## LOW DISK RESSOURCES IPFS MODE
[[ ! $(cat /tmp/mycron | grep -F 'SHELL') ]] && echo "SHELL=/bin/bash" > /tmp/newcron
[[ ! $(cat /tmp/mycron | grep -F 'PATH') ]] && echo "PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin" >> /tmp/newcron
cat /tmp/mycron >> /tmp/newcron
# ADD 20h12.process.sh line
echo "12 20 * * * /bin/bash $MY_PATH/../20h12.process.sh > /tmp/20h12.log 2>&1" >> /tmp/newcron
crontab /tmp/newcron
fi
fi