We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Agent进程的启停都是通过control脚本来控制的,但是目前control脚本的stop()函数写得有点简单粗暴,在以下场景下会导致Agent进程无法通过control脚本来停止,只能通过手动kill来停止的情况。
再现方法
[root@testvm agent]# ./control start falcon-agent started..., pid=19849 [root@testvm agent]# ll var/ -rw-rw-r-- 1 foobar foobar 120 7?. 18 15:46 app.log -rw-r--r-- 1 root root 6 7?. 18 15:46 app.pid
[foobar@testvm agent]$ ./control stop ./control: line 52: kill: (19849) - Operation not permitted falcon-agent stoped...
[root@testvm agent]# ll var/ -rw-rw-r-- 1 foobar foobar 120 7?. 18 15:46 app.log
[root@testvm agent]# ./control stop cat: var/app.pid: No such file or directory kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec] falcon-agent stoped...
[foobar@testvm agent]$ ps -ef | grep falcon-agent root 19849 1 0 15:46 pts/2 00:00:00 ./falcon-agent -c cfg.json foobar 19895 19703 0 15:49 pts/0 00:00:00 grep falcon-agent
看了一下control脚本的代码,stop()函数无条件地删除pid文件,但是实际上kill命令本身是依赖pid文件的内容的。虽然从脚本顺序上是kill在前,删pid在后。但是,kill命令本身有可能失败,失败时仍然不计一切地删除pid文件则会导致后续的kill命令永远不可能成功。同理,无条件地输出“$app stoppend...”也并不友好,因为有可能会带来误解。
function stop() { pid=`cat $pidfile` kill $pid rm -f $pidfile echo "$app stoped..." }
The text was updated successfully, but these errors were encountered:
function stop() { pid=`ps -ef | grep "falcon-agent -c cfg.json" | grep -v grep| awk '{print $2}'` kill -9 $pid pid=`ps -ef | grep "falcon-agent -c cfg.json" | grep -v grep| awk '{print $2}'| wc -l` if [ $pid = 0 ]; then rm -f $pidfile echo "$app stoped success..." else echo "$app stoped fail..." exit 1 fi }
Sorry, something went wrong.
No branches or pull requests
Agent进程的启停都是通过control脚本来控制的,但是目前control脚本的stop()函数写得有点简单粗暴,在以下场景下会导致Agent进程无法通过control脚本来停止,只能通过手动kill来停止的情况。
再现方法
[foobar@testvm agent]$ ps -ef | grep falcon-agent root 19849 1 0 15:46 pts/2 00:00:00 ./falcon-agent -c cfg.json foobar 19895 19703 0 15:49 pts/0 00:00:00 grep falcon-agent
看了一下control脚本的代码,stop()函数无条件地删除pid文件,但是实际上kill命令本身是依赖pid文件的内容的。虽然从脚本顺序上是kill在前,删pid在后。但是,kill命令本身有可能失败,失败时仍然不计一切地删除pid文件则会导致后续的kill命令永远不可能成功。同理,无条件地输出“$app stoppend...”也并不友好,因为有可能会带来误解。
The text was updated successfully, but these errors were encountered: