mirror of
https://github.com/Websoft9/websoft9.git
synced 2024-12-04 05:20:35 +00:00
Update and rename auto_getport.sh to auto_addport.sh
This commit is contained in:
parent
e7851117ec
commit
cc004fb2ea
2 changed files with 16 additions and 1 deletions
16
scripts/auto_addport.sh
Normal file
16
scripts/auto_addport.sh
Normal file
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
|
||||
|
||||
app_port=$(cat /data/apps/$1/.env |grep APP_HTTP_PORT |cut -d= -f2 |sed -n 1p)
|
||||
|
||||
while true
|
||||
do
|
||||
app_port_lines=$(cat /tmp/port.txt |grep "$app_port" |wc -l)
|
||||
if [ "$app_port_lines" -gt 0 ];then
|
||||
app_port=`expr $app_port + 1`
|
||||
else
|
||||
echo $app_port >> /tmp/port.txt
|
||||
sed -i "s/APP_HTTP_PORT=*/APP_HTTP_PORT=$app_port/g" /data/apps/$1/.env
|
||||
break
|
||||
fi
|
||||
done
|
|
@ -1 +0,0 @@
|
|||
|
Loading…
Reference in a new issue