Quote:
Originally Posted by milu_k
Thanks everyone for their valuable inputs.
With your inputs & search on google I made smalll scripts & its working for me.....
-----------------------------------------------
if test `find "/mylogfilepath" -mmin +10`
then
echo old enough
kill -9 `pgrep ProcessName`
fi
-----------------------------------------------
Pls reply me with your valuable suggestions.
|
Its best not to use "kill -9" as your first choice to shut down a process. Use "kill" instead. "kill" is a request to the app that it shut itself down, which allows it to clean up any immediate unfinished business and make an orderly exit. "kill -9" is an immediate forced shutdown of the app by the system, which may leave a mess of partially completed business behind it that may cause very obscure errors later on.
If you use kill first, wait a little and if the app is still active then use kill -9, it might save some grief.
Also, grep returns a list of everything that matches its argument, so if there is more than one instance running of the app you want to shut down, it will return a list of them all. I don't know how kill reacts to receiving a list, but if its like other linux commands, it will kill every instance on the list, not just one of them.