개발
[python] background process in python - (2)
도깨비!
2022. 6. 9. 00:34
반응형
python background scripting시 &을 붙이면 된다 했었습니다.
그런데 터미널을 아예 닫아버리니 꺼지네요. 그래서 linux에서 background scripting할 방법을 가져왔습니다.
nohup을 사용하면 됩니다
# code에 interval or 실행 조건을 줍니다
sleep(100)
threading.Timer(5, printhello).start()
# python script 실행시 nohup, &을 붙여줍니다
nohup python 파일명 &
# 종료하는 법
ps -ef | grep 파일명.py
kill -9 {pid}