모델 돌릴 때 서버와 연결이 끊겨도 종료되지 않도록 nohup을 사용하는 방법을 정리해봤습니다. 그냥 vscode 터미널에 아래와 같이 입력하시면 됩니다.
실행 nohup python train.py >> nohup_log.out &
nohup python train.py >> nohup_log.out &
로그 보기 tail -f nohup_log.out
tail -f nohup_log.out
멈추기 ps -ef | grep python 으로 pid 확인 후 kill -9 pid번호
ps -ef | grep python 으로 pid 확인 후 kill -9 pid번호
퍼미션 요구할 시 chmod u+x script.py
chmod u+x script.py