sudo kill -9 `ps -ef |cat application.pid |grep -v 'grep \|tail'|awk '{print $1}'`

时间: 2023-10-24 08:06:13 浏览: 38
As an AI language model, I cannot execute commands on a machine. However, I can explain what the above command does: The command `ps -ef` lists all the running processes. The output of ` -ef` is piped to `cat application.pid`, which displays the contents of the file `application.pid`. The output of the `cat` command is then piped to `grep -v 'grep \|tail'`, which removes any lines containing the string 'grep' or 'tail'. Finally, the output of `grep` is piped to `awk '{print $1}'`, which prints the first column (the process ID) of the remaining lines. The entire command is enclosed in backticks (` `) which means the output of the entire command is used as an argument to `kill -9`, which forcefully terminates the specified process IDs. Overall, the command is used to find the process ID of a running application using the `application.pid` file and then forcefully terminating it using the `kill -9` command.

相关推荐

centos7检测可能存在的语法错误,并给出正确的代码 #!/bin/bash # Shell变量配置 cpu_usage_limit=1 cpu_duration=10 disk_usage_limit=90 disk_duration=90 mem_usage_limit=90 mem_duration=70 interval=10 #内网ip #server_ip=ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/' #外网ip server_ip=curl -s tool.aizsk.com/ip | grep -Eo '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' #通知地址 api_url="http://192.168.220.1:18181/jeecg-boot/luodiye/sendMsg" # 监控函数 monitor() { # CPU监控 cpu_usage=top -bn1 | grep "Cpu(s)" | awk '{print $2 + $4}' if [ $(echo "${cpu_usage} > ${cpu_usage_limit}" | bc) -eq 1 ]; then cpu_duration_check=ps -eo pcpu,args | sort -k 1 -r | head -n 3 json_data="{\"server_ip\":\"${server_ip}\",\"resource\":\"cpu\",\"usage\":\"${cpu_usage}\",\"duration\":\"${cpu_duration}\",\"top_process\":\"${cpu_duration_check}\"}" curl -H "Content-Type: application/json" -X POST -d "${json_data}" ${api_url} fi # 硬盘监控 disk_usage=df -h | awk '$NF=="/"{printf "%s\n", $5}' if [ $(echo "${disk_usage} > ${disk_usage_limit}" | bc) -eq 1 ]; then disk_duration_check=du -sh /* 2>/dev/null | sort -hr | head -n 3 json_data="{\"server_ip\":\"${server_ip}\",\"resource\":\"disk\",\"usage\":\"${disk_usage}\",\"duration\":\"${disk_duration}\",\"top_files\":\"${disk_duration_check}\"}" curl -H "Content-Type: application/json" -X POST -d "${json_data}" ${api_url} fi # 内存监控 mem_usage=free -m | awk 'NR==2{printf "%.2f%%", $3*100/$2 }' if [ $(echo "${mem_usage} > ${mem_usage_limit}" | bc) -eq 1 ]; then mem_duration_check=ps aux --sort=-%mem | awk 'NR<=3{print $11}' json_data="{\"server_ip\":\"${server_ip}\",\"resource\":\"memory\",\"usage\":\"${mem_usage}\",\"duration\":\"${mem_duration}\",\"top_process\":\"${mem_duration_check}\"}" curl -H "Content-Type: application/json" -X POST -d "${json_data}" ${api_url} fi } while true; do monitor sleep ${interval} done

#!/bin/bash print_log=$(tail -n 1000 /home/cti/.ros/cloud_scheduling_node/cloud_scheduling_node.log | grep -a 状态预览 | tail -n 1 | awk '{print $0}') reboot=false for argument in "$@";do if [[ $argument == "reboot" ]];then reboot=true echo reboot needed fi done building=$(echo $print_log | awk -F '大楼全称: "' '{print $2}' | awk -F '"' '{print $1}') floor=$(echo $print_log | awk -F '当前位置: \\(' '{print $2}' | awk -F 'F' '{print $1}') x=$(echo $print_log | awk -F 'x:' '{print $2}' | awk -F "y" '{print $1}') y=$(echo $print_log | awk -F 'y:' '{print $2}' | awk -F "yaw" '{print $1}') yaw=$(echo $print_log | awk -F 'yaw:' '{print $2}' | awk -F "]" '{print $1}') if $reboot;then echo rostopic pub /mission_schedule/force_reboot mission_schedule/coordinatesMsg "\"{buildingName: '$building', floorName: '$floor', x: $x, y: $y, yaw: $yaw}"\" >topic.bash else echo rostopic pub /mission_schedule/relocate mission_schedule/coordinatesMsg "\"{buildingName: '$building', floorName: '$floor', x: $x, y: $y, yaw: $yaw}"\" >topic.bash fi date echo 正在停止服务! sudo service br stop sleep 3 for package in "$@";do if [[ "$package" == br*.deb ]];then sudo dpkg -i --force-overwrite "$package" echo $package 版本升级成功 sleep 3 fi done #source /opt/cti/kinetic/setup.bash #cd /opt/cti/kinetic/share/br_bringup/launch/ #nohup roslaunch br_bringup start_br.launch &>/dev/null& #echo "###################################################################################################################################" #sleep 5 #echo "###################################################################################################################################" #if $reboot;then # date # date # date # echo "###################################################################################################################################" # rostopic pub /mission_schedule/force_reboot mission_schedule/coordinatesMsg "\"{buildingName: '$building', floorName: '$floor', x: $x, y: $y, yaw: $yaw}"\" # echo rostopic pub /mission_schedule/force_reboot mission_schedule/coordinatesMsg "\"{buildingName: '$building', floorName: '$floor', x: $x, y: $y, yaw: $yaw}"\" #else # date # date # date # echo "###################################################################################################################################" # rostopic pub /mission_schedule/relocate mission_schedule/coordinatesMsg "\"{buildingName: '$building', floorName: '$floor', x: $x, y: $y, yaw: $yaw}"\" # echo rostopic pub /mission_schedule/relocate mission_schedule/coordinatesMsg "\"{buildingName: '$building', floorName: '$floor', x: $x, y: $y, yaw: $yaw}"\" #fi

最新推荐

recommend-type

java+毕业设计+扫雷(程序).rar

ensp校园网络毕业设计,java+毕业设计+扫雷(程序)
recommend-type

【图像增强】 GUI同态滤波图像增晰(含高斯滤波、一阶、二阶巴特沃斯滤波)【含Matlab源码 4397期】.zip

Matlab领域上传的视频均有对应的完整代码,皆可运行,亲测可用,适合小白; 1、代码压缩包内容 主函数:main.m; 调用函数:其他m文件;无需运行 运行结果效果图; 2、代码运行版本 Matlab 2019b;若运行有误,根据提示修改;若不会,私信博主; 3、运行操作步骤 步骤一:将所有文件放到Matlab的当前文件夹中; 步骤二:双击打开main.m文件; 步骤三:点击运行,等程序运行完得到结果; 4、仿真咨询 如需其他服务,可私信博主或扫描视频QQ名片; 4.1 博客或资源的完整代码提供 4.2 期刊或参考文献复现 4.3 Matlab程序定制 4.4 科研合作
recommend-type

Wox全局搜索工具,一款win下的全局搜索软件

Wox全局搜索工具类似mac的全局搜索功能,在win下可以实时搜索电脑上安装的软件及文档,节省了找文档的时间,可在在不会到桌面的情况下使用Alt+回车搜索需要的内容。
recommend-type

C语言程序判断回文素数

附件是判断回文素数C语言程序,这个程序首先定义了两个函数:isPrime 用于判断一个数是否为素数,isPalindrome 用于判断一个数是否为回文。然后在 main 函数中,通过一个循环来检查从2到999(这里假设我们只需要检查小于1000的数)的所有数,如果一个数既是素数又是回文数,就将其打印出来。 请注意,这个程序只检查了小于1000的数。如果需要检查更大的范围,可以相应地调整循环的上限。此外,素数判断的效率并不是最优的,对于大数的判断,可能需要更高效的算法。
recommend-type

课设毕设基于SSM的抗疫医疗用品销售平台 LW+PPT+源码可运行.zip

课设毕设基于SSM的抗疫医疗用品销售平台 LW+PPT+源码可运行
recommend-type

zigbee-cluster-library-specification

最新的zigbee-cluster-library-specification说明文档。
recommend-type

管理建模和仿真的文件

管理Boualem Benatallah引用此版本:布阿利姆·贝纳塔拉。管理建模和仿真。约瑟夫-傅立叶大学-格勒诺布尔第一大学,1996年。法语。NNT:电话:00345357HAL ID:电话:00345357https://theses.hal.science/tel-003453572008年12月9日提交HAL是一个多学科的开放存取档案馆,用于存放和传播科学研究论文,无论它们是否被公开。论文可以来自法国或国外的教学和研究机构,也可以来自公共或私人研究中心。L’archive ouverte pluridisciplinaire
recommend-type

实现实时数据湖架构:Kafka与Hive集成

![实现实时数据湖架构:Kafka与Hive集成](https://img-blog.csdnimg.cn/img_convert/10eb2e6972b3b6086286fc64c0b3ee41.jpeg) # 1. 实时数据湖架构概述** 实时数据湖是一种现代数据管理架构,它允许企业以低延迟的方式收集、存储和处理大量数据。与传统数据仓库不同,实时数据湖不依赖于预先定义的模式,而是采用灵活的架构,可以处理各种数据类型和格式。这种架构为企业提供了以下优势: - **实时洞察:**实时数据湖允许企业访问最新的数据,从而做出更明智的决策。 - **数据民主化:**实时数据湖使各种利益相关者都可
recommend-type

云原生架构与soa架构区别?

云原生架构和SOA架构是两种不同的架构模式,主要有以下区别: 1. 设计理念不同: 云原生架构的设计理念是“设计为云”,注重应用程序的可移植性、可伸缩性、弹性和高可用性等特点。而SOA架构的设计理念是“面向服务”,注重实现业务逻辑的解耦和复用,提高系统的灵活性和可维护性。 2. 技术实现不同: 云原生架构的实现技术包括Docker、Kubernetes、Service Mesh等,注重容器化、自动化、微服务等技术。而SOA架构的实现技术包括Web Services、消息队列等,注重服务化、异步通信等技术。 3. 应用场景不同: 云原生架构适用于云计算环境下的应用场景,如容器化部署、微服务
recommend-type

JSBSim Reference Manual

JSBSim参考手册,其中包含JSBSim简介,JSBSim配置文件xml的编写语法,编程手册以及一些应用实例等。其中有部分内容还没有写完,估计有生之年很难看到完整版了,但是内容还是很有参考价值的。