I have a Python process that uses os.popen to run tcpdump in the background. It then reads and processes the output from tcpdump. The process runs in the background as a daemon. When I execute this process from the command line, it runs just fine--it fires up tcpdump and reads the output properly. However, I want this process to run automatically at boot and I've directed it to do so in cron. When I do this, my process is running (per the ps command) but tcpdump is not.
Is there some reason the behavior is different starting a process in cron vs starting it from the command line? My code looks something like this:
p = os.popen('/usr/sbin/tcpdump -l -i eth0')
while True:
data = p.readline()
# do something with data