Browse Source

check ports

master
zeus 2 months ago
parent
commit
7ad68d9cdf
  1. 11
      install.sh
  2. 35
      src-local/llo/new.js
  3. 27
      start.sh

11
install.sh

@ -10,6 +10,17 @@ wdir_connect="$wdir/src-local/hybrid/connect"
toolsok='ok'
if [[ $EUID -eq 0 ]]; then
echo ""
echo "This script must be run without root privileges"
echo ""
echo "Do not run this script with root privileges. Do not use 'sudo'. "
echo ""
exit 1
fi
# create wdir connect dir
if [ ! -d $wdir_connect ];then
mkdir -p $wdir_connect

35
src-local/llo/new.js

@ -1758,11 +1758,46 @@ io.on('connection', function(socket) {
service_port = newport
}
var newport1 = ''
const servertest1 = apptest.listen(0, () => {
servertest1.close();
})
newport1 = servertest1.address().port
var newport2 = ''
const servertest2 = apptest.listen(0, () => {
servertest2.close();
})
newport2 = servertest2.address().port
var newport3 = ''
const servertest3 = apptest.listen(0, () => {
servertest3.close();
})
newport3 = servertest3.address().port
var newport4 = ''
const servertest4 = apptest.listen(0, () => {
servertest4.close();
})
newport4 = servertest4.address().port
var newport5 = ''
const servertest5 = apptest.listen(0, () => {
servertest5.close();
})
newport5 = servertest5.address().port
var ENV_service_file = `
REGISTRY_ADDR=localhost
REGISTRY_PORT=5000
IMAGE_NAME=${service}
SSH_PORT=${service_port}
R_PORT1=${newport1}
R_PORT2=${newport2}
R_PORT3=${newport3}
R_PORT4=${newport4}
R_PORT5=${newport5}
TEST=${service}
`
//console.log('value1 '+JSON.stringify(ENV_service_file_path))

27
start.sh

@ -1,5 +1,32 @@
#!/bin/bash
if lsof -Pi :3080 -sTCP:LISTEN -t >/dev/null ; then
echo ""
echo "Can't start Swarmlab.io hybrid, port 3080 busy "
echo ""
echo "This might be the process that is causing this problem:"
echo ""
lsof -i :3080
echo ""
exit 1
fi
if lsof -Pi :3088 -sTCP:LISTEN -t >/dev/null ; then
echo ""
echo "Can't start Swarmlab.io hybrid, port 3088 busy "
echo ""
echo "This might be the process that is causing this problem:"
echo ""
lsof -i :3088
echo ""
exit 1
fi
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
TARGET="$(readlink "$SOURCE")"

Loading…
Cancel
Save