feat: Initial commit
This commit is contained in:
22
Lab07/es5.sh
Normal file
22
Lab07/es5.sh
Normal file
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
finds=0
|
||||
while :
|
||||
do
|
||||
line=$(ps -el | tr -s " " | cut -d " " -f 2,4,14 | grep $1 | cut -d " " -f 1,2)
|
||||
if [[ $(echo $line | cut -d " " -f 1) = "Z" ]]
|
||||
then
|
||||
let finds++
|
||||
if [[ $finds -ge 5 ]]; then
|
||||
pid=$(echo $line | cut -d " " -f 2)
|
||||
kill -9 $pid
|
||||
echo "Killed process $pid"
|
||||
exit 0
|
||||
fi
|
||||
elif [[ $finds -ne 0 ]]
|
||||
then
|
||||
finds=0
|
||||
fi
|
||||
|
||||
sleep $2
|
||||
done
|
||||
Reference in New Issue
Block a user