服务器后台继续任务
服务器后台继续任务(在服务器上后台运行命令,关闭SSH客户端后程序继续运行)
单行命令
重新运行(禁用tqdm)
TQDM_DISABLE=1 nohup python -u train2.py > train.log 2>&1 &
1、nohup python train2.py > train.log 2>&1 & ,使用 nohup
2、查看运行状态:
ps aux | grep train2.py
3、停止程序:
kill
重新登录后,查看程序是否还在运行
ps aux | grep train2.py
tail -f train.log # 实时查看日志
多行命令
1、新建sh
vi test.sh
接着i,编辑模式
复制
#!/bin/bash
python main.py test
–config config.yaml
–data.dataset_dir ./dataset/
–data.source_modality T2
–data.target_modality CT
–data.test_batch_size 1
–ckpt_path ./models/ssz_ct_t2_ct.ckpt
esc
:wq!
2、# 赋予执行权限
chmod +x test.sh
3、# 后台运行并记录日志
nohup ./test.sh > test.log 2>&1 &
4、方式 2:直接在命令行执行
nohup python main.py test
–config config.yaml
–data.dataset_dir ./dataset/
–data.source_modality T2
–data.target_modality CT
–data.test_batch_size 1
–ckpt_path ./models/ssz_ct_t2_ct.ckpt
> test.log 2>&1 &
}}双击到最后(快捷方式)
另外:
数据集在服务器中查询
./当前路径
…/上一层
./…/Mydataset
[1] 985278 ps -ef | grep train2.py
vi train.log
esc :q!
重新运行(禁用tqdm)
TQDM_DISABLE=1 nohup python -u train2.py > train.log 2>&1 &
