In vscode ssh, let the program run in the background of the server and save the results to the log

Reference: https://cloud.videojj.com/help/docs/faq.html#id10

Assume that the target file to be trained here is gcn_res_cs.py.

1. Put the program to run in the background, and write the standard output and error output to the .log file

nohup python gcn_res_cs.py > ./gcn_res_cs.log 2>&1 &

2. View the output results in the real-time log.

Note that in Python 3 need to use print("", flush=True)to make real-time logs written to a file.

tail -f ./gcn_res_cs.log

3. Check the process PID and whether it is running

ps aux | grep gcn_res_cs.py

4. Terminate the process that is running in the background, replace the PID with the actual process number, if it cannot be terminated, use kill -9

kill -15 PID

Guess you like

Origin blog.csdn.net/weixin_41650348/article/details/115353219