Astroport.ONE/20h12.process.sh

94 lines
2.9 KiB
Bash
Raw Normal View History

#!/bin/bash
########################################################################
# Version: 0.3
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
########################################################################
MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
2022-12-29 14:51:05 +01:00
. "$MY_PATH/tools/my.sh"
2022-09-12 11:36:39 +02:00
start=`date +%s`
2022-12-29 14:51:05 +01:00
echo "20H12 (♥‿‿♥) $(hostname -f) $(date)"
2022-11-17 13:15:23 +01:00
espeak "Ding" > /dev/null 2>&1
2022-10-21 20:56:11 +02:00
## CLEANING ~/.zen/tmp
2022-11-23 14:59:04 +01:00
rm -Rf ~/.zen/tmp/*
2022-10-21 20:56:11 +02:00
2022-09-23 14:57:04 +02:00
## RESTART IPFS DAEMON
2023-04-14 17:42:58 +02:00
LOWMODE=$(sudo systemctl status ipfs | grep disabled) ## IPFS DISABLED - START ONLY FOR SYNC -
2022-09-23 14:57:04 +02:00
# echo "$USER ALL=(ALL) NOPASSWD:/bin/systemctl" | (sudo su -c 'EDITOR="tee" visudo -f /etc/sudoers.d/systemctl')
2023-04-14 17:42:58 +02:00
if [[ $LOWMODE != "" ]]; then
sudo systemctl start ipfs && sleep 10
else
sudo systemctl restart ipfs && sleep 10
fi
2022-09-23 14:57:04 +02:00
2023-01-01 20:37:09 +01:00
espeak "CODE git pull" > /dev/null 2>&1
2022-11-17 13:15:23 +01:00
2022-09-23 14:57:04 +02:00
## PROCESS TW BACKOFFICE TREATMENT
2023-04-08 15:20:16 +02:00
[[ -s ~/.zen/G1BILLET/G1BILLETS.sh ]] \
&& cd ~/.zen/G1BILLET/ && git pull \
&& rm -Rf ~/.zen/G1BILLET/tmp/*
2023-04-05 14:48:08 +02:00
2022-09-14 14:29:19 +02:00
cd ~/.zen/Astroport.ONE/
git pull
2023-04-05 14:48:08 +02:00
2022-10-01 16:18:15 +02:00
## SOON /ipns/ Address !!!
2022-09-14 14:29:19 +02:00
2023-04-05 14:48:08 +02:00
espeak "20 HOURS 12 MINUTES. ASTROBOT RUNNING." > /dev/null 2>&1
2022-12-18 21:26:57 +01:00
## Updating yt-dlp
$MY_PATH/youtube-dl.sh
sudo youtube-dl -U
2022-10-01 16:18:15 +02:00
# Refresh ~/.zen/game/world/G1VOEU
2023-06-30 13:50:34 +02:00
# NOW RUN FROM PLAYER.refresh.sh !! ~/.zen/Astroport.ONE/RUNTIME/VOEUX.refresh.sh
2022-09-12 11:36:39 +02:00
2022-12-09 02:54:13 +01:00
espeak "Players refresh" > /dev/null 2>&1
2022-10-01 16:18:15 +02:00
# Refresh ~/.zen/game/players/PLAYER
2023-06-30 13:50:34 +02:00
~/.zen/Astroport.ONE/RUNTIME/PLAYER.refresh.sh
2022-09-12 11:36:39 +02:00
## if [[ ! $isLAN ]]; then
## REFRESH BOOTSTRAP LIST (OFFICIAL SWARM)
2022-12-25 23:39:22 +01:00
espeak "bootstrap refresh" > /dev/null 2>&1
ipfs bootstrap rm --all > /dev/null 2>&1
for bootnode in $(cat ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | grep -Ev "#") # remove comments
do
ipfsnodeid=${bootnode##*/}
ipfs bootstrap add $bootnode
done
## fi
2022-09-23 14:57:04 +02:00
2022-09-12 11:36:39 +02:00
########################################################################
end=`date +%s`
2022-12-09 02:54:13 +01:00
dur=`expr $end - $start`
echo "20H12 (♥‿‿♥) Execution time was $dur" seconds.
2022-11-04 20:08:33 +01:00
2023-07-01 20:32:32 +02:00
# ~/.zen/Astroport.ONE/tools/ipfs_P2P_forward.sh ## COULD FORWARD LOCAL TCP PORT TO SWARM
rm ~/.zen/game/players/localhost/latest
2023-01-08 04:54:12 +01:00
2022-11-04 20:08:33 +01:00
## MAIL LOG : support@qo-op.com
2023-01-17 19:42:04 +01:00
$MY_PATH/tools/mailjet.sh "support@g1sms.fr" "/tmp/20h12.log"
2022-11-04 20:08:33 +01:00
2023-04-05 14:48:08 +02:00
espeak "duration was $dur seconds" > /dev/null 2>&1
2022-12-25 23:39:22 +01:00
2023-01-03 18:42:41 +01:00
espeak "Restarting Astroport Station API" > /dev/null 2>&1
2022-12-25 23:39:22 +01:00
## CLOSING API PORT
[[ -s ~/.zen/.pid ]] && kill -9 $(cat ~/.zen/.pid)
2023-02-03 22:35:05 +01:00
## KILL ALL REMAINING nc
2023-03-12 22:31:11 +01:00
killall nc 12345.sh
2022-12-25 23:39:22 +01:00
## OPEN API ENGINE
2023-03-12 22:31:11 +01:00
if [[ ! -f /etc/systemd/system/astroport.service ]]; then
~/.zen/Astroport.ONE/12345.sh > ~/.zen/tmp/12345.log &
PID=$!
echo $PID > ~/.zen/.pid
else
2023-04-05 14:48:08 +02:00
sudo systemctl restart astroport
[[ -s ~/.zen/G1BILLET/G1BILLETS.sh ]] && sudo systemctl restart g1billet
echo "systemd restart"
2023-03-12 22:31:11 +01:00
fi
2022-11-15 17:23:23 +01:00
## IPFS DISABLED : STOP IT
2023-04-14 17:42:58 +02:00
[[ $LOWMODE != "" ]] && sleep 360 && sudo systemctl stop ipfs
2022-09-12 11:36:39 +02:00
exit 0