Wire-Py/start_wg.py
2025-05-23 12:36:28 +02:00

25 lines
631 B
Python
Executable File

#!/usr/bin/python3
"""
This script belongs to wirepy and is for the auto start of the tunnel
"""
from subprocess import CompletedProcess, run
from wp_app_config import AppConfig, logging
from common_tools import ConfigManager
ConfigManager.init(AppConfig.SETTINGS_FILE)
if ConfigManager.get("autostart") != "off":
process: CompletedProcess[str] = run(
["nmcli", "connection", "up", ConfigManager.get("autostart")],
capture_output=True,
text=True,
check=False,
)
# Output from start_wg error
if process.stderr:
logging.error(process.stderr, exc_info=True)
else:
pass