我有一个嵌入式系统,我在其上telnet运行,然后在后台运行一个应用程序:
./app_name &
Run Code Online (Sandbox Code Playgroud)
现在如果我关闭我的终端并telnet从其他终端做,如果我检查然后我可以看到这个过程仍在运行.
为了检查这个,我写了一个小程序:
#include<stdio.h>
main()
{
while(1);
}
Run Code Online (Sandbox Code Playgroud)
我在后台运行我的本地linux pc程序,然后我关闭了终端.
现在,当我从其他终端检查这个过程时,我发现这个过程也被杀死了.
我的问题是:
我的下面的代码工作正常,但仍然"cppcheck"发出警告,
Either the condition 'mem_limit_str!=0' is redundant or there is possible null pointer dereference: mem_limit_str.
Run Code Online (Sandbox Code Playgroud)
下面是代码,
if (mem_limit_str!= NULL) //CPPCHECK error
free(mem_limit_str);
Run Code Online (Sandbox Code Playgroud)
任何人都可以帮我解决这个问题吗?
我正在编写一个小脚本,我必须检查特定进程是否正在运行?然后根据我必须采取行动.是的shell是bash.
要检查进程是否正在运行?从这我试过,
Process_Num='ps -ef | grep /opt/sro/bin/srocmsd | grep -v "grep" | wc -l'
if [ $Process_Num -eq 1 ]
then
***Do Stuff***
else
***Do Stuff***
fi
Run Code Online (Sandbox Code Playgroud)
但我得到错误:
**Error : line 191: [: too many arguments**
Run Code Online (Sandbox Code Playgroud)
在shell/terminal上直接运行相同的命令时,输出为1.
有语法错误吗?可以帮助吗?