| 12345678910111213141516171819202122 |
- #!/bin/bash
- app_name='devops-agent.jar'
- pid=`ps aux | grep ${app_name} | grep -v 'grep' | tr -s ' '| cut -d ' ' -f 2`
- echo "process id: "${pid}
- if [[ -z ${pid} ]];
- then
- echo "process killed"
- else
- kill -15 ${pid}
- fi
- echo "sleep 10s and wait process killed"
- sleep 10
- pid=`ps aux | grep ${app_name} | grep -v 'grep' | tr -s ' '| cut -d ' ' -f 2`
- if [[ -z ${pid} ]];
- then
- echo "${app_name} has killed"
- else
- echo "process ${pid} not killed"
- fi
|