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