HI i would like to know how i can simulate a shell scripts for my requirement.
example
Server name child Process id Parent Process id
Vpesh 16013 15637
Server name child Process id Parent Process id
Vpesh 16014 15637
Server name child Process id Parent Process id
Vpesh 16015 15638
Server name child Process id Parent Process id
Vpesh 16016 15638
Most of the time we restart our server by killing child processes ids , so processes will come again with new child id and parent id . My requirement is - When Parent Process id is 1 that time system should not kill the child processes , it should display one msg" Parent Process id is 1 , you should kill this process" .
How can i simulate this ?
This is simple command i wrote to kill only child processes ids but it doesn't look for parent id .. so whenever parent id is 1 , this command is killing child processes .which is not acceptable .
kill -9 `ps -ef | grep processes | grep -v grep | awk '{print $2}'`
Thank
Vaibhav