Hello all,
I'm in need of a Script which needs to wait for all the child process to end and then kill the main process.
I have a process called
mainpp
which runs for different instances like
evpn, nge, gmn etc
so when i query for
mainpp
process it looks like below.
bash-3.2$ ps -eaf | grep -i mainpp
mainpp 14474 13672 0 mrt 08 ? 14:17 /opt/mainpp/bin/mon /opt/mainpp/etc/emtn-gsm.conf
mainpp 14535 13672 0 mrt 08 ? 17:25 /opt/mainpp/bin/mon /opt/mainpp/etc/gmnjuniper.conf
mainpp 14627 13672 0 mrt 08 ? 6:28 /opt/mainpp/bin/mon /opt/mainpp/etc/pwifi.conf
mainpp 14636 13672 0 mrt 08 ? 1109:43 /opt/mainpp/bin/mon /opt/mainpp/etc/wwp.conf
mainpp 14546 13672 0 mrt 08 ? 31:07 /opt/mainpp/bin/mon /opt/mainpp/etc/gmnwwp.conf
mainpp 14440 13672 0 mrt 08 ? 1741:35 /opt/mainpp/bin/mon /opt/mainpp/etc/alcatel.conf
mainpp 14447 13672 0 mrt 08 ? 13:18 /opt/mainpp/bin/mon /opt/mainpp/etc/asr9001.conf
the child process gets invoked for every 5 mins, and looks like below
bash-3.2$ ps -eaf | grep -i mainpp | grep -i rtr
mainpp 17628 13672 0 11:10:08 ? 0:00 /opt/mainpp/bin/rtr poll.5 /opt/mainpp/etc/alcatel.conf
mainpp 17213 13672 0 11:10:01 ? 0:00 /opt/mainpp/bin/rtr poll.3 /opt/mainpp/etc/os6250.conf
mainpp 17487 13672 0 11:10:06 ? 0:00 /opt/mainpp/bin/rtr poll.10 /opt/mainpp/etc/eok.conf
mainpp 17211 13672 0 11:10:01 ? 0:00 /opt/mainpp/bin/rtr poll.4 /opt/mainpp/etc/os6250.conf
mainpp 17025 13672 0 11:10:01 ? 0:00 /opt/mainpp/bin/rtr poll.1 /opt/mainpp/etc/axxerra.conf
mainpp 17503 13672 0 11:10:06 ? 0:00 /opt/mainpp/bin/rtr poll.0 /opt/mainpp/etc/wwp.conf
mainpp 17217 13672 0 11:10:01 ? 0:00 /opt/mainpp/bin/rtr poll.1 /opt/mainpp/etc/os6250.conf
mainpp 17470 13672 0 11:10:05 ? 0:00 /opt/mainpp/bin/rtr poll.4 /opt/mainpp/etc/wwp.conf
mainpp 17493 13672 0 11:10:06 ? 0:00 /opt/mainpp/bin/rtr poll.7 /opt/mainpp/etc/eok.conf
mainpp 17483 13672 0 11:10:06 ? 0:00 /opt/mainpp/bin/rtr poll.12 /opt/mainpp/etc/eok.conf
mainpp 17626 13672 0 11:10:08 ? 0:00 /opt/mainpp/bin/rtr poll.6 /opt/mainpp/etc/alcatel.conf
mainpp 17457 13672 0 11:10:05 ? 0:00 /opt/mainpp/bin/rtr poll.18 /opt/mainpp/etc/eok.conf
mainpp 17467 13672 0 11:10:05 ? 0:00 /opt/mainpp/bin/rtr poll.13 /opt/mainpp/etc/eok.conf
mainpp 17141 13672 0 11:10:01 ? 0:00 /opt/mainpp/bin/rtr poll.0 /opt/mainpp/etc/gmncisco.conf
mainpp 17465 13672 0 11:10:05 ? 0:00 /opt/mainpp/bin/rtr poll.14 /opt/mainpp/etc/eok.conf
mainpp 17640 13672 0 11:10:08 ? 0:00 /opt/mainpp/bin/rtr poll.2 /opt/mainpp/etc/alcatel.conf
mainpp 17633 13672 0 11:10:08 ? 0:00 /opt/mainpp/bin/rtr poll.4 /opt/mainpp/etc/alcatel.conf
mainpp 17463 13672 0 11:10:05 ? 0:00 /opt/mainpp/bin/rtr poll.15 /opt/mainpp/etc/eok.conf
mainpp 17501 13672 0 11:10:06 ? 0:00 /opt/mainpp/bin/rtr poll.1 /opt/mainpp/etc/wwp.conf
mainpp 17449 13672 0 11:10:05 ? 0:00 /opt/mainpp/bin/rtr poll.7 /opt/mainpp/etc/wwp.conf
mainpp 17511 13672 0 11:10:06 ? 0:00 /opt/mainpp/bin/rtr poll.3 /opt/mainpp/etc/eok.conf
mainpp 17635 13672 0 11:10:08 ? 0:00 /opt/mainpp/bin/rtr poll.3 /opt/mainpp/etc/alcatel.conf
after 5 mins, the
rtr
process gets ended on its own depends of work stack it has in its list, once the
rtr
is ended then i would like to kill
mainpp
i need a script which will wait for the
rtr
process to end and then kill the
mainpp
its just one time activity everyday, as i need to reboot the interfacing application and there is no particular time for the same so i need the script to trigger whenever i want.
Please help me with this.
Thanks!!