unstable: environment variable for systemctl required
This commit is contained in:
parent
651dbdc5be
commit
4cff2d65a7
|
@ -6,4 +6,4 @@
|
||||||
|
|
||||||
> $ sh install.sh
|
> $ sh install.sh
|
||||||
|
|
||||||
После этого в браузере на localhost:8000 должны появиться данные о погоде.
|
После этого в браузере на localhost:7841 должны появиться данные о погоде.
|
|
@ -2,9 +2,10 @@
|
||||||
Description=Weather collection service
|
Description=Weather collection service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
|
$DIR=/home/citrullux/ModernOSWeather
|
||||||
Type=simple
|
Type=simple
|
||||||
WorkingDirectory=/home/citrullux/ModernOSLabs/src
|
WorkingDirectory=/home/citrullux/ModernOSWeather/src
|
||||||
ExecStart=/usr/bin/python3 /home/citrullux/ModernOSLabs/src/main.py
|
ExecStart=/usr/bin/python3 /home/citrullux/ModernOSWeather/src/main.py
|
||||||
Restart=always
|
Restart=always
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
|
|
|
@ -2,13 +2,11 @@ import filecmp
|
||||||
import subprocess
|
import subprocess
|
||||||
import os
|
import os
|
||||||
from time import sleep
|
from time import sleep
|
||||||
from server import weather_run
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
def install(parsed) -> None:
|
def install() -> None:
|
||||||
args = parsed.parse_args()
|
|
||||||
if args.install:
|
|
||||||
projectDir = Path(__file__).resolve().parent.parent
|
projectDir = Path(__file__).resolve().parent.parent
|
||||||
homeDir = Path(os.getenv("HOME"))
|
homeDir = Path(os.getenv("HOME"))
|
||||||
serviceDirExist = os.path.isdir(os.path.join(homeDir, ".config/systemd/user/"))
|
serviceDirExist = os.path.isdir(os.path.join(homeDir, ".config/systemd/user/"))
|
||||||
|
@ -27,5 +25,3 @@ def install(parsed) -> None:
|
||||||
subprocess.call(["sh", os.path.join(projectDir, "scripts/runner.sh")])
|
subprocess.call(["sh", os.path.join(projectDir, "scripts/runner.sh")])
|
||||||
|
|
||||||
sleep(5)
|
sleep(5)
|
||||||
else:
|
|
||||||
weather_run()
|
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
from installer import install
|
from installer import install
|
||||||
|
from server import weather_run
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
flags = argparse.ArgumentParser()
|
flags = argparse.ArgumentParser()
|
||||||
flags.add_argument("--install", "-i", action="store_true")
|
flags.add_argument("--install", "-i", action="store_true")
|
||||||
|
args = flags.parse_args()
|
||||||
|
|
||||||
install(flags)
|
if args.install:
|
||||||
|
install()
|
||||||
|
weather_run()
|
|
@ -5,7 +5,7 @@ from weather import weather_handler
|
||||||
|
|
||||||
|
|
||||||
def weather_run(server_class=HTTPServer, handler_class=BaseHTTPRequestHandler):
|
def weather_run(server_class=HTTPServer, handler_class=BaseHTTPRequestHandler):
|
||||||
server_address = ("", int(os.getenv("PORT", "8000")))
|
server_address = ("", int(os.getenv("PORT", "7841")))
|
||||||
httpd = server_class(server_address, WeatherHandler)
|
httpd = server_class(server_address, WeatherHandler)
|
||||||
httpd.serve_forever()
|
httpd.serve_forever()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user