Shell脚本无助于杀死Tomcat应用程序

I've to replicate behaviour of CTRL+C using shell script to turned down tomcat application server. Hence wrote following code in Jenkins pipeline script -

sh '''pgrep -fl catalina | awk '{print $1}' | xargs kill -SIGINT'''

但是它不会拒绝应用程序。但是,如果我从终端执行了相同的命令,则会关闭应用程序-

pgrep -fl catalina | awk '{print $1}' | xargs kill -SIGINT

您能帮忙了解Shell脚本代码的问题吗?

评论