日期:2014-05-16  浏览次数:20626 次

linux后台守护进程阻塞的方法
有没有谁知道如何阻塞Linux后台守护进程(比如cupsd),并在一段时间后解除阻塞状态,谢谢!
linux 守护进程

------解决方案--------------------
引用:
C/C++ code?123char cmd_stop[32] = {0};    sprintf(cmd_stop,"kill -SIGSTOP %d",cupsd_pid);    system(cmd_stop);
cupsd_pid是我通过pgrep cupsd获取到得

既然是C代码,那就直接使用C API,,,,, 你的问题应该是由于shell对命令的解释问题。 shell对字符串的解释问题一向有些杂。

 #include <sys/types.h>
       #include <signal.h>

       int kill(pid_t pid, int sig);

kill(cupsd_pid, SIGSTOP);