i've created a py file to monitor my home network. The script it self is running ok.
I've created a service with systemd that will run this script every 30 sec and copy it in /etc/systemd/system/
.
This is the service file:
[Unit]
Description=Monitor Network Connection
After=multi-user.target network-online.target networking.service
[Service]
Type=idle
WorkingDirectory=/home/pi
ExecStartPRE=bin/sleep 3
ExecStart=/usr/bin/python /home/pi/BoApp/monitor_net.py
Restart=on-abort
[Timer]
OnBootSec=30
OnUnitActiveSec=30
[Install]
WantedBy=multi-user.target
WantedBy=timers.target
Now, when i manually start the service and do a status check, i get:
monitor_net.service - Monitor Network Connection
Loaded: loaded (/etc/systemd/system/monitor_net.service; enabled; vendor preset: enabled)
**Active: inactive (dead)** since Sun 2020-10-11 11:28:21 EEST; 1min 28s ago
Process: 1699 ExecStart=/usr/bin/env python3 /home/pi/BoApp/monitor_net.py (code=exited, status=0/SUCCESS)
Main PID: 1699 (code=exited, status=0/SUCCESS)
Basically it only runs the py script once and then stop.
Can you help me here to understand why this service is inactive ?
Many thanks!