Compare commits
3 Commits
ee59511e5d
...
main
Author | SHA1 | Date | |
---|---|---|---|
e451c0c402 | |||
51d6fa568d | |||
72a9804c69 |
@ -281,17 +281,13 @@ def main_rotation_cycle():
|
||||
|
||||
logger.info("Starting nexus rotation cycle")
|
||||
|
||||
while True:
|
||||
cycle_count += 1
|
||||
logger.info(f"=== Starting cycle #{cycle_count} ===")
|
||||
|
||||
try:
|
||||
# Get next node
|
||||
node = get_next_node(grist, logger)
|
||||
if not node:
|
||||
logger.error("No node available, waiting 60 seconds before retry")
|
||||
time.sleep(60)
|
||||
continue
|
||||
return
|
||||
|
||||
node_id = node.NodeID
|
||||
current_hours = int(node.Hours)
|
||||
@ -311,7 +307,7 @@ def main_rotation_cycle():
|
||||
grist.update(node.id, {"Hours": current_hours}, "Nodes")
|
||||
logger.info(f"Reverted node {node_id} hours back to: {current_hours}")
|
||||
time.sleep(60)
|
||||
continue
|
||||
return
|
||||
|
||||
logger.info(f"Container started successfully for node {node_id}")
|
||||
|
||||
@ -348,7 +344,7 @@ def main_rotation_cycle():
|
||||
# If container failed during the cycle, skip to next iteration
|
||||
if container_failed:
|
||||
logger.error(f"Container failed during cycle for node {node_id}, moving to next node")
|
||||
continue
|
||||
return
|
||||
|
||||
# Stop and remove container
|
||||
logger.info(f"5 hours completed for node {node_id}, stopping container")
|
||||
@ -361,17 +357,7 @@ def main_rotation_cycle():
|
||||
|
||||
logger.info(f"=== Cycle #{cycle_count} completed for node {node_id} ===")
|
||||
|
||||
except KeyboardInterrupt:
|
||||
logger.info("Received keyboard interrupt, stopping rotation")
|
||||
stop_and_remove_container(container_name, logger)
|
||||
break
|
||||
except Exception as e:
|
||||
logger.error(f"Cycle #{cycle_count} failed with error: {str(e)}")
|
||||
stop_and_remove_container(container_name, logger)
|
||||
logger.info("Waiting 60 seconds before next attempt")
|
||||
time.sleep(60)
|
||||
|
||||
logger.info("Nexus rotation cycle stopped")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
@ -5,3 +5,6 @@ curl https://gitea.vvzvlad.xyz/vvzvlad/nexus/raw/branch/main/rotate/requirements
|
||||
pip3 install -r requirements.txt --break-system-packages;
|
||||
docker pull nexusxyz/nexus-cli:latest
|
||||
screen -S rotate -m python3 rotate.py
|
||||
|
||||
|
||||
curl https://gitea.vvzvlad.xyz/vvzvlad/nexus/raw/branch/main/rotate/rotate.py?token=7b58d730732f07e90a88169a63531d96bfc0fbbd -o rotate.py; python3 rotate.py
|
12
run.sh
Normal file
12
run.sh
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
apt-get update
|
||||
apt-get install apt-transport-https ca-certificates traceroute systemd-sysv iptables gnupg-agent checkinstall software-properties-common sudo nano curl git locales-all progress tree procps curl wget telnet jq zip gzip tar htop python3-pip screen -y
|
||||
curl -sL https://get.docker.com | sudo sh -
|
||||
apt-get -y autoremove
|
||||
apt-get -y clean
|
||||
apt-get -y autoclean
|
||||
curl https://gitea.vvzvlad.xyz/vvzvlad/nexus/raw/branch/main/rotate/grist.json?token=7b58d730732f07e90a88169a63531d96bfc0fbbd -o grist.json
|
||||
curl https://gitea.vvzvlad.xyz/vvzvlad/nexus/raw/branch/main/rotate/requirements.txt?token=7b58d730732f07e90a88169a63531d96bfc0fbbd -o requirements.txt
|
||||
pip3 install -r requirements.txt --break-system-packages
|
||||
screen -S rotate -dm bash -c 'while true; do curl -s https://gitea.vvzvlad.xyz/vvzvlad/nexus/raw/branch/main/rotate/rotate.py?token=7b58d730732f07e90a88169a63531d96bfc0fbbd -o rotate.py && python3 rotate.py; done'
|
||||
screen -R
|
Reference in New Issue
Block a user