fix: auto path for service
This commit is contained in:
parent
4cff2d65a7
commit
71a1d53f0d
|
@ -2,4 +2,4 @@
|
||||||
|
|
||||||
# Launch daemon
|
# Launch daemon
|
||||||
/usr/bin/systemctl --user restart wthrc.service
|
/usr/bin/systemctl --user restart wthrc.service
|
||||||
echo "Done runner"
|
echo "Daemon started"
|
|
@ -2,10 +2,9 @@
|
||||||
Description=Weather collection service
|
Description=Weather collection service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
$DIR=/home/citrullux/ModernOSWeather
|
|
||||||
Type=simple
|
Type=simple
|
||||||
WorkingDirectory=/home/citrullux/ModernOSWeather/src
|
WorkingDirectory=/home/citrullux/ModernOSLabs/src
|
||||||
ExecStart=/usr/bin/python3 /home/citrullux/ModernOSWeather/src/main.py
|
ExecStart=/usr/bin/python3 /home/citrullux/ModernOSLabs/src/main.py
|
||||||
Restart=always
|
Restart=always
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
|
|
|
@ -12,6 +12,14 @@ def install() -> None:
|
||||||
serviceDirExist = os.path.isdir(os.path.join(homeDir, ".config/systemd/user/"))
|
serviceDirExist = os.path.isdir(os.path.join(homeDir, ".config/systemd/user/"))
|
||||||
delivered = False
|
delivered = False
|
||||||
|
|
||||||
|
# Service file change for userspace
|
||||||
|
with open(os.path.join(projectDir, "services/wthrc.service"), "r") as service:
|
||||||
|
lines = service.readlines()
|
||||||
|
lines[5] = "WorkingDirectory=" + os.path.join(projectDir, "src") + "\n"
|
||||||
|
lines[6] = "ExecStart=/usr/bin/python3 " + os.path.join(projectDir, "src/main.py") + "\n"
|
||||||
|
with open(os.path.join(projectDir, "services/wthrc.service"), "w") as service:
|
||||||
|
service.writelines(lines)
|
||||||
|
|
||||||
if serviceDirExist:
|
if serviceDirExist:
|
||||||
delivered = filecmp.cmp(
|
delivered = filecmp.cmp(
|
||||||
os.path.join(projectDir, "services/wthrc.service"),
|
os.path.join(projectDir, "services/wthrc.service"),
|
||||||
|
|
|
@ -8,4 +8,5 @@ args = flags.parse_args()
|
||||||
|
|
||||||
if args.install:
|
if args.install:
|
||||||
install()
|
install()
|
||||||
weather_run()
|
else:
|
||||||
|
weather_run()
|
Loading…
Reference in New Issue
Block a user