Created
June 29, 2025 13:41
-
-
Save skpywatts/4cbbca4e98746e0d0a6f77d2fb07e51c to your computer and use it in GitHub Desktop.
Nexus Node Auto-Run Script with Swap Setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
### === CONFIGURATION === | |
NODE_ID=7065410 | |
LOG_FILE=nexus.log | |
### === 1. Enable 4G Swap (if missing) === | |
if ! swapon --show | grep -q '/swapfile'; then | |
echo "[*] Creating 4G swap file..." | |
sudo fallocate -l 4G /swapfile | |
sudo chmod 600 /swapfile | |
sudo mkswap /swapfile | |
sudo swapon /swapfile | |
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab | |
else | |
echo "[*] Swap file already exists." | |
fi | |
### === 2. Auto-Run Nexus in a Restart Loop === | |
echo "[*] Starting Nexus node with auto-restart..." | |
while true; do | |
echo "[$(date)] Starting nexus-network..." | |
nexus-network start --node-id $NODE_ID >> $LOG_FILE 2>&1 | |
echo "[$(date)] nexus-network crashed. Restarting in 10 seconds..." >> $LOG_FILE | |
sleep 10 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment