0
点赞
收藏
分享

微信扫一扫

【opencv】示例-fback.cpp 使用OpenCV库来实现密集光流算法

云岭逸人 2024-04-17 阅读 12
#!/bin/bash
process_name=chromedriver
process_name2=webdriver
#查找并杀死进程名 
PID=`ps -ef |grep $process_name|grep -v grep|awk '{print $2}'|xargs`
PID2=`ps -ef |grep $process_name2|grep -v grep|awk '{print $2}'|xargs`
save_file="/usr/local/software/ship/sadmin/clean/cleanlog.log"
current_time=$(date "+%Y-%m-%d %H:%M:%S")
#判断进程号是否存在
if [[ -z $PID ]]; then
    echo -e "\n\n\n$current_time】暂无可删除的$process_name记录" >> $save_file
else
    kill -9 $PID
    echo -e "\n\n\n$current_time】已删除$process_name的【$PID】进程" >> $save_file
    PID_NOW=`ps -ef |grep $process_name|grep -v grep|awk '{print $2}'|xargs`
    echo -e "-------------------当前$process_name有【$PID_NOW】进程" >> $save_file
fi
if [[ -z $PID2 ]]; then
    echo -e "\n\n\n$current_time】暂无可删除的$process_name2记录" >> $save_file
else
    kill -9 $PID2
    echo -e "\n\n\n$current_time】已删除$process_name的【$PID2】进程" >> $save_file
    PID_NOW2=`ps -ef |grep $process_name2|grep -v grep|awk '{print $2}'|xargs`
    echo -e "-------------------当前$process_name有【$PID_NOW2】进程" >> $save_file
fi

日志打印信息
在这里插入图片描述

举报

相关推荐

0 条评论