Hi community,
I'm running a python script as a systemd service. The task of the script is extremely simple: check the last few lines of the file for changes. However, the problem is that for some reason, when the script is running as a systemd service, nothing happens, what I mean, is that the file is not read, and if there are any changes, the script does not react to it in any way. I would like to note that in the local environment everything works as it should, after running the script, the file is scanned for changes and if they are found, the action is performed.
Has anyone experienced this and can advise what the problem is?
In the script, I use the 'while True' loop. And here's how the .service file looks like:
```
[Unit]
Description=Look for changes
After=multi-user.target
[Service]
Type=simple
Restart=always
Environment="FILE=/path/to/script/file.txt"
WorkingDirectory=/path/to/script
ExecStart=/usr/bin/python3 /path/to/script/script.py
[Install]
WantedBy=multi-user.target
```
I'm running a python script as a systemd service. The task of the script is extremely simple: check the last few lines of the file for changes. However, the problem is that for some reason, when the script is running as a systemd service, nothing happens, what I mean, is that the file is not read, and if there are any changes, the script does not react to it in any way. I would like to note that in the local environment everything works as it should, after running the script, the file is scanned for changes and if they are found, the action is performed.
Has anyone experienced this and can advise what the problem is?
In the script, I use the 'while True' loop. And here's how the .service file looks like:
```
[Unit]
Description=Look for changes
After=multi-user.target
[Service]
Type=simple
Restart=always
Environment="FILE=/path/to/script/file.txt"
WorkingDirectory=/path/to/script
ExecStart=/usr/bin/python3 /path/to/script/script.py
[Install]
WantedBy=multi-user.target
```