shell腳本殺進(jìn)程 linux判斷進(jìn)程是否在執(zhí)行(知道進(jìn)程名),沒執(zhí)行重啟進(jìn)程。怎么用linux腳本實(shí)現(xiàn)?
linux判斷進(jìn)程是否在執(zhí)行(知道進(jìn)程名),沒執(zhí)行重啟進(jìn)程。怎么用linux腳本實(shí)現(xiàn)?結(jié)合使用PS command和grep command來確定服務(wù)名稱是否存在:SVC=“sendmail”IFPs
linux判斷進(jìn)程是否在執(zhí)行(知道進(jìn)程名),沒執(zhí)行重啟進(jìn)程。怎么用linux腳本實(shí)現(xiàn)?
結(jié)合使用PS command和grep command來確定服務(wù)名稱是否存在:SVC=“sendmail”IFPs EF | grep$SVC | egrep vgrep>/dev/nullthenecho“$svcisstarted!“elseeeecho”$svcnotfound!“fi Description:PS EF:顯示當(dāng)前正在運(yùn)行的所有進(jìn)程|:pipeline,即上一個(gè)命令的輸出,作為以下命令的輸入grepservice uuName:在輸出信息中,查找服務(wù)uName數(shù)據(jù)行egrep vgrep:不顯示grep search命令本身