[英]Why is my python program on linux not executing after i terminate the program?
SIGSTOP
不会终止程序,它会暂停它,因此它不会被杀死。 您应该向程序发送SIGCONT
或键入fg
以继续它。
SIGTSTP 或 SIGSTOP 信号被挂起,不能杀死这个程序,使用 SIGCONT 信号你可以唤醒并继续它
Signal Description Signal number on Linux x86[1]
SIGABRT Process aborted 6
SIGALRM Signal raised by alarm 14
SIGBUS Bus error: "access to undefined portion of memory object" 7
SIGCHLD Child process terminated, stopped (or continued*) 17
SIGCONT Continue if stopped 18
SIGFPE Floating point exception: "erroneous arithmetic operation" 8
SIGHUP Hangup 1
SIGILL Illegal instruction 4
SIGINT Interrupt 2
SIGKILL Kill (terminate immediately) 9
SIGPIPE Write to pipe with no one reading 13
SIGQUIT Quit and dump core 3
SIGSEGV Segmentation violation 11
SIGSTOP Stop executing temporarily 19
SIGTERM Termination (request to terminate) 15
SIGTSTP Terminal stop signal 20
SIGTTIN Background process attempting to read from tty ("in") 21
SIGTTOU Background process attempting to write to tty ("out") 22
SIGUSR1 User-defined 1 10
SIGUSR2 User-defined 2 12
SIGPOLL Pollable event 29
SIGPROF Profiling timer expired 27
SIGSYS Bad syscall 31
SIGTRAP Trace/breakpoint trap 5
SIGURG Urgent data available on socket 23
SIGVTALRM Signal raised by timer counting virtual time: "virtual timer expired" 26
SIGXCPU CPU time limit exceeded 24
SIGXFSZ File size limit exceeded 25
您应该确保您的线程在守护进程模式下运行。 当您点击ctrl-c
时,这可能是阻止它们干净退出的原因。 像这样设置它们:
t = threading.Thread()
t.daemon = True // <- this is the important bit...
t.start()
好的,我找到了解决方案。
在你的 linux 终端上输入以下命令:
ps -ef |grep yourfile.py
您将看到许多仍在后台运行的进程。 要杀死它们,请输入以下命令:
kill -9 pid
不要输入pid。 键入标识进程的数字,如终端显示中所示
使用以下命令杀死所有进程并确保没有后台进程在运行。
Ctrl+\\
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.