SystemD Service - Python Script Problem (Network Manager)
by Gronjus from LinuxQuestions.org on (#6J9NM)
Hello everyone,
I am an embedeed Electronics Engineer and since 2 two months, I started to develop on a Debian Distro for a client.
I am actually developing a project which have a part that handles a MODEM4G & the os Connectivity. The modem is managed by AT Commands and the os connectivity mainly with ping and curl command.
The python script is working fine so far and have tested it for like 2 weeks now. I am happy with it but now, I am in the script automation phase.
I have tried to launch my script at boot with systemd and with the old school method (init.d). Both launched the script correctly but I am getting problem with the ouput of my ping and curl command.
Once the modem have been setted up with AT Commands, I am using a "nmcli device connect" command from the NetworkManager Package to get an ip from the network and can then interact with the network command as ping and curl.
When launched as systemd service or with the help of init.d, the output of the command are failing. I can not ping the host and the curl result is "000".
Still, when looking at Network Manager status, there is a valid ip,dns,route and even outside the script, using ping and curl command have the same failing behaviour.
Looking for solutions, I have found that Network Manager is using DBUS Session for the service to work and it seems complex to implement that kind of package with script started at boot.
I am bit stuck and I am wondering if anyone has suggestions for troubleshooting deeper ?
I have already set up Network Manager logging as debug but nothing relevant.
Thanks a lot for your help !
Antoine
I am an embedeed Electronics Engineer and since 2 two months, I started to develop on a Debian Distro for a client.
I am actually developing a project which have a part that handles a MODEM4G & the os Connectivity. The modem is managed by AT Commands and the os connectivity mainly with ping and curl command.
The python script is working fine so far and have tested it for like 2 weeks now. I am happy with it but now, I am in the script automation phase.
I have tried to launch my script at boot with systemd and with the old school method (init.d). Both launched the script correctly but I am getting problem with the ouput of my ping and curl command.
Once the modem have been setted up with AT Commands, I am using a "nmcli device connect" command from the NetworkManager Package to get an ip from the network and can then interact with the network command as ping and curl.
When launched as systemd service or with the help of init.d, the output of the command are failing. I can not ping the host and the curl result is "000".
Still, when looking at Network Manager status, there is a valid ip,dns,route and even outside the script, using ping and curl command have the same failing behaviour.
Looking for solutions, I have found that Network Manager is using DBUS Session for the service to work and it seems complex to implement that kind of package with script started at boot.
I am bit stuck and I am wondering if anyone has suggestions for troubleshooting deeper ?
I have already set up Network Manager logging as debug but nothing relevant.
Thanks a lot for your help !
Antoine