Mar-21-2020, 06:00 PM
Hi,
The code below which speaks a wellcome msg if there's an internet connection, runs manually but not at boot through crontab.
Where did I go wrong?
TIA
The code below which speaks a wellcome msg if there's an internet connection, runs manually but not at boot through crontab.
Where did I go wrong?
TIA
#!/usr/local/bin/python3
from subprocess import call
from time import sleep
domain = ('www.google.com')
def _call():
call(['espeak "Welcome John" 2>/dev/null'], shell=True)
def ping(host):
ret = call(['ping', '-c', '3', '-W', '5', host], stdout=open('/dev/null', 'w'), stderr=open('/dev/null', 'w'))
return ret
if __name__ == "__main__":
p = 1
while p == 1:
p = ping(domain)
if(p == 0):
_call()
sleep(.3)

I don't see that. I'm running linux on a raspberry zero W board.