mirror of
https://github.com/pablorevilla-meshtastic/meshview.git
synced 2026-03-04 23:27:46 +01:00
Improves arguments in mvrun.py
This commit is contained in:
committed by
Joel Krauska
parent
44671a1358
commit
74369deaea
15
mvrun.py
15
mvrun.py
@@ -59,12 +59,9 @@ def signal_handler(sig, frame):
|
||||
|
||||
|
||||
# Run python in subprocess
|
||||
def run_script(script_name, pid_file, *args):
|
||||
def run_script(python_executable, script_name, pid_file, *args):
|
||||
process = None
|
||||
try:
|
||||
# Path to the Python interpreter inside the virtual environment
|
||||
python_executable = './env/bin/python'
|
||||
|
||||
# Combine the script name and arguments
|
||||
command = [python_executable, script_name] + list(args)
|
||||
|
||||
@@ -101,11 +98,13 @@ def main():
|
||||
|
||||
# Add --config runtime argument
|
||||
parser.add_argument('--config', help="Path to the configuration file.", default='config.ini')
|
||||
parser.add_argument('--piddir', help="PID files path.", default='.')
|
||||
parser.add_argument('--pyexec', help="Path to the Python executable.", default='./env/bin/python')
|
||||
args = parser.parse_args()
|
||||
|
||||
# PID file paths
|
||||
db_pid_file = 'meshview-db.pid'
|
||||
web_pid_file = 'meshview-web.pid'
|
||||
db_pid_file = os.path.join(args.piddir, 'meshview-db.pid')
|
||||
web_pid_file = os.path.join(args.piddir, 'meshview-web.pid')
|
||||
|
||||
# Track PID files globally for cleanup
|
||||
pid_files.append(db_pid_file)
|
||||
@@ -113,12 +112,12 @@ def main():
|
||||
|
||||
# Database Thread
|
||||
dbthrd = threading.Thread(
|
||||
target=run_script, args=('startdb.py', db_pid_file, '--config', args.config)
|
||||
target=run_script, args=(args.pyexec, 'startdb.py', db_pid_file, '--config', args.config)
|
||||
)
|
||||
|
||||
# Web server thread
|
||||
webthrd = threading.Thread(
|
||||
target=run_script, args=('main.py', web_pid_file, '--config', args.config)
|
||||
target=run_script, args=(args.pyexec, 'main.py', web_pid_file, '--config', args.config)
|
||||
)
|
||||
|
||||
# Start Meshview subprocess threads
|
||||
|
||||
Reference in New Issue
Block a user