The scenario where the problem occurs is probably
1 cron calls a Python script
2. In the Python script, call a shell script (for log analysis) to obtain the shell output and then send an email.
Similar to a monitoring task.
There is no problem in directly executing the Python script, but after writing it in cron, the relative path in the shell script cannot be found, and it always prompts that some files cannot be found.
The problem solved later was to use the absolute path of the log file and the operation would be normal.
Google has found that many people have encountered similar problems, which may be related to the cron mechanism.
Most people's problems are caused by environment variables, because cron is an independent process, not a user login, and so on, so some programs cannot be executed successfully.
Similar: http://stackoverflow.com/questions/2388087/how-to-get-cron-to-call-in-the-correct-paths
However, many scripts are basically absolute paths, and I may write too little. Many principles and principles are not very clear.
This article is from"Orangleliu notebook" ? Blog, please be sure to keep this source http://blog.csdn.net/orangleliu/article/details/38641417