I'm working on a python script running on a script, which would upload some files to the server. Probably, this needs internet connectivity to be turned on. I'm seeing a log pi@raspberrypi dhcpd[5] carrier lost in /var/log/syslog when the internet lost and carrier acquired, when internet connection available. Is there a way to get this as an event in my python program.


You didn't tell us if you'd tried anything, and so I'll assume that you haven't. If that's the case, I'd suggest you take a look at this answer from Stack Overflow SE. In a nutshell, it suggests that you use David Beazley's Generator Tricks for Python, but the code is actually on Beazley's GitHub page. I think the specific code you'll need is this one

All of this for the price of an Internet search :)

Try this; let us know if you have any RPi-related issues.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.