i can get top 5 memories processes using ps aux command, but i want to know is there any command or shell script for this to kill after finding top memories from server.
If you are running a database or a web server, then either or both are likely to be in the top 5 processes for memory. You may want to look at how much memory is allocated by the applications on your server and shrink the memory pool of those applications. You would likely need to restart the applications. Hence you should probably get downtime.
If you kill the wrong process you will probably need a reboot, and if you don't change the memory allocation, you will still be short on memory after the reboot.
i want to know is there any command or shell script for this to kill after finding top memories from server.
Of course there is, albeit i have to give the same warnings jiliagre and zaxxon already issued: don't do it, because this is not a sound procedure.
Look at the output of ps aux:
You need the second column (the PID) for the kill command. Further, you need to disregard the first line because it contains headers rather than data:
Your ps-output may differ slightly from mine (i took mine from an AIX system, not having a HP-Ux system at hand) and you might have to adjust the command slightly. There might be processes which do not respond to signal 15 (this would indicate poor programming) so you might need to change kill -15 <pid> to kill -9 <pid>. If you do so, programs will not be able to clean up after them: shared memory segments, FIFOs and the like as well as temporary files with be left over.
Test thoroughly before you remove the "echo"-statement. Even with thorough testing i suggest to never use this.
I wanted to know how to find the memory taken by a process using top command. The output of the top command is as follows as an example:
Mem: 13333364k total, 13238904k used, 94460k free, 623640k buffers
Swap: 25165816k total, 112k used, 25165704k free, 4572904k cached
PID USER ... (6 Replies)
Good afternoon
I need to KILL a process in a single command sentence, for example:
kill -9 `ps -aef | grep 'CAL255.4ge' | grep -v grep | awk '{print $2}'`
That sentence Kills the process ID corresponding to the program CAL255.4ge.
However it is possible that the same program... (6 Replies)
Hello,
I'd like to set a cron job that runs a shell script every 30 minutes or so to restart a java based service if the memory gets above 80%. Any advice on how to do this?
Thanks in advance!
- Ryan (19 Replies)
i have edited a script to kill an exact mysql process is causing the high load on the server, my problem is, kill dont kill it!
script:
#!/bin/sh
top -n 1 -u mysql | grep mysqld | awk '{print $1}' > pid
proc='cat pid'
kill -9 $proc
or i try with
kill -9 `top -n 1 -u mysql | grep mysqld... (8 Replies)
Okay, I am trying to come up with a multi-platform script to report top ten CPU and memory hog processes, which will be run by our enterprise monitoring application as an auto-action item when the CPU and Memory utilization gets reported as higher than a certain threshold
I use top on other... (5 Replies)
HI All,
Can anyone send me a command to find TOP 5 Memory consuming process.
It would be lelpful if I get output something like below
processname - pid - memory(in MB) - command
I tried few commands from the internet but the result only give the real memory usage or pagging, I want total... (4 Replies)
Hi Unix Gurus i am somewhat new to unix scripting so need your help to
create a script as below.
# This script would find the process consuming memory beyond a certain #limit. if the meemory consumption is more than 100% for a period of 1
# minute for the specific process. the script would... (0 Replies)
I want to Kill a process without using kill command as i don't have privileges to kill the process. I know the pid and i am using Linux 2.6.9 OS. (6 Replies)
Hi All,
I am unable to kill a process using kill command. I am using HP-UX system. I have tried with kill -9 and i have root privilages.
How can i terminate this daemon ? ? ?
Regards,
Vijay Hegde (3 Replies)