英文:
ctrl-z to suspend running process suddenly not working in tmux panel
问题
Job运行时间过长,但不想终止它。在将进程发送到后台之前,通常在任何tmux面板/窗口中使用ctrl-z,但由于我不知道的原因,这个键组合突然在该特定面板上停止工作。但在其他tmux面板上ctrl-z似乎可以正常工作。
作业目前正在运行:
for f in *.webm; do ffmpeg -fflags +genpts -i "$f" -map 0 -s hd1080 -c:v libx264 -preset slower -crf 18 -b:a 64k "${f%.webm}".mp4; done
为什么ctrl-z突然停止工作有特殊原因吗?
英文:
Job's running too long, but don't want to terminate it. Before sending the process to background, I usually use ctrl-z in any tmux panel/window wihtout any problem, but for unknown reasons to me, this key combination suddenly stopped working for that particular panel. ctrl-z seems to work on other tmux panels though.
The job's currently running:
for f in *.webm; do ffmpeg -fflags +genpts -i "$f" -map 0 -s hd1080 -c:v libx264 -preset slower -crf 18 -b:a 64k "${f%.webm}".mp4; done
Any particular reason why ctrl-z would suddenly stop working?
答案1
得分: 1
根据您的评论,您输入的bg
命令使该命令成为一个单独的作业,因此它不会响应通常的Ctrl命令。如果它仍然是最近的命令,您可以运行fg
将其带回前台,然后再使用Ctrl+Z暂停它。
否则,我建议执行类似以下的操作:
ps -aux | grep ffmpeg
以获取进程的PID。一旦您获得了PID,您可以使用kill
命令来停止、继续或终止该进程。
附言:如果您计划将来运行长时间的作业,您可能想考虑使用nohup
和/或将输出重定向到文件。
英文:
Based on your comment, the bg
command you entered made the command become a separate job, so it wouldn't respond to the usual ctrl commands. If it is still the most recent command, you can run fg
to bring it back to the foreground to be able to pause it with ctrl-z again.
Otherwise, I'd recommend doing something like
ps -aux | grep ffmpeg
to get the PID of the process. Once you have that, you can stop, continue or terminate the process with the kill
command.
p.s. If you plan to have long-running jobs in the future, you might want to consider using nohup
and/or redirecting the output to a file.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论