linux - nohup 2>&1输出日志
阿神
阿神 2017-04-17 17:07:13
0
2
961
阿神
阿神

闭关修行中......

reply all(2)
阿神

Execution order issue, the code inside "``" is executed first, and the execution result is nested in the outer command as a string

eventually became

nohup python demo.py > /data/log_2017-04-10_.log 2>&1 &

Through the ps command you can see that there is only one process python demo.pyps命令你可以看到只有一个进程python demo.py

即使过了00:00

Even after 00:00, the PID of the process will not change🎜
大家讲道理

Use crontab to execute scheduled tasks,
There are two methods to handle it

  1. Kill the process regularly every day and re-execute your command

  2. Fix the file name of a log and rename the log file according to date regularly every day.
    The second method does not require stopping the application, but you can also customize the granularity of the log files yourself. You can have one file per hour~

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template