I made a cool bash script for those running safenode-manager that wants to specify ports, shows last port for last started node and delay between node starts. Instructions below the bash script.
#!/bin/bash
Function to display usage information
usage() {
echo “Usage: $0 -n <number_of_times> -p <start_port> -o -d <delay_in_minutes> -c <node_count>”
exit 1
}
Parse command-line arguments
while getopts “n:p:o:d:c:” opt; do
case “$opt” in
n) num_times=$OPTARG ;;
p) start_port=$OPTARG ;;
o) owner=$OPTARG ;;
d) delay_minutes=$OPTARG ;;
c) node_count=$OPTARG ;;
*) usage ;;
esac
done
Check if all required arguments are provided
if [ -z “$num_times” ] || [ -z “$start_port” ] || [ -z “$owner” ] || [ -z “$delay_minutes” ] || [ -z “$node_count” ]; then
usage
fi
Loop to execute the commands the specified number of times
for (( i=0; i<num_times; i++ )); do
end_port=((start_port + node_count - 1))
echo “Running: safenode-manager add --count $node_count --node-port $start_port-$end_port --owner $owner”
safenode-manager add --count $node_count --node-port $start_port-$end_port --owner $owner
echo "Running: safenode-manager start"
safenode-manager start
start_port=$((end_port + 1))
# If not the last iteration, wait for the specified delay
if [ $i -lt $((num_times - 1)) ]; then
echo "Waiting for $delay_minutes minutes..."
sleep $((delay_minutes * 60))
fi
done
Report the last port used
last_port=$((end_port))
echo “The last port used in the port range interval was: $last_port”
How to Run the Script:
Save the Script:
open a notepad or similar in Linux, copy and paste the bash script
Save the updated script to your file run_safenode_manager.sh
Make the Script Executable: Might have to run command from the script location
chmod +x run_safenode_manager.sh
Run the Script:
Execute the script with the desired parameters:
./run_safenode_manager.sh -n 2 -p 12105 -o discord-name -d 3 -c 5
-n = number of times nodmanager runs and start new nodes.
-p = add start port, then the script will add the correct number of ports depending on how many nodes you choose to start.
-o = Discord name
-d = Delay between node manager starting new nodes in minutes
-c = Number of nodes starting every time node manager makes a run