Last active
August 1, 2019 11:14
-
-
Save TKasperczyk/db8fd82d491015b3119c58d30322a828 to your computer and use it in GitHub Desktop.
Runs as many proxy server instances as specified
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 | |
| # USAGE: ./runServer.sh PORT MARK COUNT | |
| # PORT - the initial TCP port that will be incremented for each server instance | |
| # MARK - the initial fwmark that will be incremented for each server instance | |
| # COUNT - the total number of server instances to run | |
| die() { echo "$*"; exit 1; } | |
| if [ -z "$1" ]; then die "No initial port specified"; fi | |
| if [ -z "$2" ]; then die "No initial mark specified"; fi | |
| if [ -z "$3" ]; then die "No server count specified"; fi | |
| INITIALPORT=$1 | |
| INITIALMARK=$2 | |
| HOWMANY=$3 | |
| for i in `seq 1 $HOWMANY`; | |
| do | |
| MARK=$INITIALMARK LD_PRELOAD=/$HOME/App-Route-Jail/mark.so /bin/node server.js > ./logs/$INITIALPORT.log $INITIALPORT & | |
| echo "PID $! running on port $INITIALPORT with mark $INITIALMARK" | |
| INITIALPORT=$((INITIALPORT + 1)) | |
| INITIALMARK=$((INITIALMARK + 1)) | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment