We may use linux nohup command to run a task without terminal and allow it to continue to run with ssl connect closed. However, how to kill this task if you want to stop it? In this tutorial, we will introduce you how to do.
For example, we can use linux nohup command to start a task as follows:
nohup python train_model_bert.py &
In this command, we will start a python script task: python train_model_bert.py.
If you plant to kill this task, we can do by following steps:
1.Find the task process id
We can use command below to find:
Then we can find:
From the result, we can find this task process id is: 10443. We can use this id to kill this task.
2.Kill a task
We can use linux kill command to stop a task, here is an example:
kill -9 10443
Then we can find that python train_model_bert.py task is stopped.