본문 바로가기

Programming/Linux_Platform

find PID as process name and send signal using shell script

#!/system/bin/sh

echo "sigquit.system_server.sh: start" > /dev/kmsg

echo "sigquit.system_server.sh: start"

sleep 10.0

str=""

echo "sigquit.system_server.sh: delay finish" > /dev/kmsg

echo "sigquit.system_server.sh: delay finish"

while [ "$str" = "" ]; do

  str=`ps | grep system_server`

  sleep 0.1

done

pid=${str:10:4}

echo "sigquit.system_server.sh: kill -3 ${pid}" > /dev/kmsg

echo "sigquit.system_server.sh: kill -3 ${pid}"

kill -3 ${pid}


Especially, the rad line should use " ` " beside num 1 key instead of " ' "