Tragic background
The machine running the active script cannot connect to toastserver,
I can only write a script myself and run it every day.
Of course, it should be placed in crontab.
5 3 * * * sh ~/nosecron.sh
Even more tragic results
The next day, I checked the results and fail was mostly used.
Annoying Analysis
Many of them are due:
catch_pkts.append(pkt.getlayer(IP).build())
AttributeError: ‘NoneType‘ object has no attribute ‘build‘
Then there is a sentence at the beginning of log:
WARNING: Failed to execute tcpdump. Check it is installed and in the PATH
Run tcpdump manually, OK
Manually run nosecron. Sh, OK
Added the echo $ path to nosecron. SH and put it in the crontab to run it again. There are only:
/Usr/sbin:/usr/bin
High-speed Solutions
Add
export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
Clever Solution
In crontab:
5 3 * * * su - root -c "sh /root/nosecron.sh"
Once and for all
Add the following to the front of crontab:
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
Unfortunately, I don't know why it doesn't take effect.
Crontab: It's not easy to love you.