Роман Романов Posted June 12, 2020 Posted June 12, 2020 Hi there! I has a OPi zero board on armbian ubuntu os. There is a python scrypt that ping server. Scrypt starts with my service. service code: [Unit] Description=My Script Service After=multi-user.target [Service] Type=simple ExecStart=/usr/bin/sudo /usr/bin/python /root/test/qr2.py RemainAfterExit=no Restart=always RestartSec=5 [Install] WantedBy=multi-user.target python ping server like: try: os.system('ping ' + ip + ' -c 4') # or # s.scall('ping ' + ip + ' -c 4 ) except: print 'ping error' Sometimes If i start system after power supply scrypt is starting, but then hangs on ping function. In Htop (image) i can see ping process. There are no python errors or exceptions. It just hangs. But if i use console command to ping server ip while scrypt hans, it pings well. If a starts scrypt manualy it works well, no hanging. Also if i execute reboot command in concole, then after restart scrypt do not hangs up.
Recommended Posts