I tried this code and it is not working
#!/bin/sh
#Find the Process ID for syncapp running instance
PID=`ps -ef | grep syncapp 'awk {print $2}'`
if [[ -z "$PID" ]] then
Kill -9 PID
fi
It is showing a error near awk.
Any suggestions please.
Actually the easiest way to do that would be to pass kill arguments like below:
ps -ef | grep your_process_name | grep -v grep | awk '{print $2}' | xargs kill
Hope it helps.