• R/O
  • SSH

manifest: Commit

A service to replicate and serve requests for site configurations based on site ID, public IP, and the on-site lead contact's OTP.


Commit MetaInfo

Revisión49296aaa6e555795adce793364d33e9fd4709386 (tree)
Tiempo2021-10-16 02:07:31
Autor4E9B58 <4e9b58@proj...>
Commiter4E9B58

Log Message

Add rudimentary startup script

Cambiar Resumen

Diferencia incremental

diff -r 66b90e808cfd -r 49296aaa6e55 src/manifest/start_manifest.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/manifest/start_manifest.sh Fri Oct 15 12:07:31 2021 -0500
@@ -0,0 +1,40 @@
1+#!/bin/bash
2+
3+set i=0
4+
5+ports=(2520, 5040, 7560, 10080, 12600, 15120, 17640, 20160,
6+ 22680, 25200, 27720, 30240, 32760, 35280, 37800, 40320,
7+ 42840, 45360, 47880, 50400, 52920, 55440, 57960, 60480,
8+ 63000, 65520)
9+
10+function find_port {
11+ for i in "${ports[@]}"; do
12+ echo "Testing port $i"
13+ if $(ss -tulpn | grep $i); then
14+ continue
15+ else
16+ echo $1
17+ fi
18+ done
19+}
20+
21+# Test for user == root
22+if [[ $EUID -eq 0 ]]; then
23+ echo "This script must NOT be run as root!"
24+ exit 1
25+fi
26+
27+port_num=$(find_port)
28+echo "$port_num"
29+
30+if [ -d "venv" ]; then
31+ # main.py will test for the presence of a virtual environment and fail if
32+ # one does not exist.
33+ source venv/bin/activate
34+ # So the port...there is a list of possible ports. What should be done is:
35+ # Use system tools to evaluate the ports available out of the internally
36+ # documented list in Network Ports.adoc, export the value to a variable to
37+ # be used in the command string for the nginx/apache proxy, and apply the
38+ # variable in the command line invocation below.
39+ gunicorn --workers=2 -k uvicorn.workers.UvicornWorker main:app --reload --port=$port_num
40+fi
\ No newline at end of file
Show on old repository browser