Wire-Py/start_wg.py

26 lines
666 B
Python
Executable File

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