First, the foregoing
There are a lot of ways that Python scripts can be written to log files on a daily basis in the actual work, and there are a number of methods to achieve this effect. This article chooses a way to realize, special will realize the detail to do the following to share, improper place please correct.
Second, the specific
1. The Python script needs to add logger output to each Python file.
As follows:
2. Add a background execution mechanism to the shell script.
Note:
1, Nohup is the key to this inside do not write the wrong format I just because written nohup .... >>file & This format led to the clear manual execution of the log output but into the scheduled task there is no log.
2, the software operating environment in this area such as ... /python must be written as an absolute path, even if the environment variable Lee is configured, because crontab cannot recognize environment variables.
3. crontab Scheduled Tasks
3 Days one execution.
In addition, do not mistakenly press Crontab-r when editing (delete all scheduled tasks) because CRONTAB-E is the editor E and R letters must have a mission to be careful not to ask me how to know. All Is tears ~ ~
The Python language--crontab writes logs to a file every day, in conjunction with a Python script implementation