<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://hlds.pl/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="pl">
		<id>http://hlds.pl/index.php?action=history&amp;feed=atom&amp;title=Process_monitor.sh</id>
		<title>Process monitor.sh - Historia wersji</title>
		<link rel="self" type="application/atom+xml" href="http://hlds.pl/index.php?action=history&amp;feed=atom&amp;title=Process_monitor.sh"/>
		<link rel="alternate" type="text/html" href="http://hlds.pl/index.php?title=Process_monitor.sh&amp;action=history"/>
		<updated>2026-06-14T14:15:39Z</updated>
		<subtitle>Historia wersji tej strony wiki</subtitle>
		<generator>MediaWiki 1.18.1</generator>

	<entry>
		<id>http://hlds.pl/index.php?title=Process_monitor.sh&amp;diff=7548&amp;oldid=prev</id>
		<title>Trawiator o 15:13, 17 gru 2007</title>
		<link rel="alternate" type="text/html" href="http://hlds.pl/index.php?title=Process_monitor.sh&amp;diff=7548&amp;oldid=prev"/>
				<updated>2007-12-17T15:13:08Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← poprzednia wersja&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Wersja z 15:13, 17 gru 2007&lt;/td&gt;
		&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Linia 37:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Linia 37:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/bash&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/bash&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[kategoria:linux]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[kategoria:linux]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;[[kategoria:Skrypty]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key wiki-wiki:diff:version:1.11a:oldid:7546:newid:7548 --&gt;
&lt;/table&gt;</summary>
		<author><name>Trawiator</name></author>	</entry>

	<entry>
		<id>http://hlds.pl/index.php?title=Process_monitor.sh&amp;diff=7546&amp;oldid=prev</id>
		<title>KaszpiR o 15:02, 17 gru 2007</title>
		<link rel="alternate" type="text/html" href="http://hlds.pl/index.php?title=Process_monitor.sh&amp;diff=7546&amp;oldid=prev"/>
				<updated>2007-12-17T15:02:30Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Nowa strona&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;bash&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script assumes your top configuration is default.&lt;br /&gt;
# Who to e-mail when a process is killed.&lt;br /&gt;
contact=&amp;quot;escapedturkey@escapedturkey.com&amp;quot;&lt;br /&gt;
# Define the top command based load threshold percentage.&lt;br /&gt;
load=&amp;quot;25&amp;quot;&lt;br /&gt;
# Define location of appending log file.&lt;br /&gt;
archive=&amp;quot;/var/log/killed.log&amp;quot;&lt;br /&gt;
# Cycle 1 -- Checking to see if a process is using too much CPU.&lt;br /&gt;
cycle1=(`top -c -b -n 1 | grep -v grep | grep -v root | grep -v bin | grep -v daemon | grep -v adm | grep -v lp | grep -v sync | grep -v shutdown | grep -v halt | grep -v mail | grep -v news | grep -v uucp | grep -v operator | grep -v games | grep -v gopher | grep -v ftp | grep -v nobody | grep -v dbus | grep -v vcsa | grep -v rpm | grep -v haldaemon | grep -v netdump | grep -v nscd | grep -v sshd | grep -v rpc | grep -v rpcuser | grep -v nfsnobody | grep -v mailnull | grep -v smmsp | grep -v pcap | grep -v xfs | grep -v Mem:     | grep -v Swap: | grep -v Cpu7 | grep -v Cpu6 | grep -v Cpu5 | grep -v Cpu4 | grep -v Cpu3 | grep -v Cpu2 | grep -v Cpu1 | grep -v Cpu0 | grep -v Tasks | grep -v top | awk '$9 &amp;gt;= '$load' { print $1 }' | tail -n 1`)&lt;br /&gt;
&lt;br /&gt;
# If nothing is found, exit.&lt;br /&gt;
if [ -z &amp;quot;$cycle1&amp;quot; ]; then&lt;br /&gt;
# Clean-up files upon exit.&lt;br /&gt;
    exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Pausing for a bit. The process may be just having a temporary spike due to a restart or map change.&lt;br /&gt;
sleep 60&lt;br /&gt;
&lt;br /&gt;
# Cycle 2 -- Checking again to see if the process is still using too much CPU.&lt;br /&gt;
cycle2=(`top -c -b -n 1 | grep -v grep | grep -v root | grep -v bin | grep -v daemon | grep -v adm | grep -v lp | grep -v sync | grep -v shutdown | grep -v halt | grep -v mail | grep -v news | grep -v uucp | grep -v operator | grep -v games | grep -v gopher | grep -v ftp | grep -v nobody | grep -v dbus | grep -v vcsa | grep -v rpm | grep -v haldaemon | grep -v netdump | grep -v nscd | grep -v sshd | grep -v rpc | grep -v rpcuser | grep -v nfsnobody | grep -v mailnull | grep -v smmsp | grep -v pcap | grep -v xfs | grep -v Mem: | grep -v Swap: | grep -v Cpu7 | grep -v Cpu6 | grep -v Cpu5 | grep -v Cpu4 | grep -v Cpu3 | grep -v Cpu2 | grep -v Cpu1 | grep -v Cpu0 | grep -v Tasks | grep -v top | awk '$9 &amp;gt;= '$load' { print $1 }' | tail -n 1`)&lt;br /&gt;
&lt;br /&gt;
# Comparing to see if the same process is using too much CPU, if so kill the process, if not, exit the script.&lt;br /&gt;
if [ &amp;quot;$cycle1&amp;quot; = &amp;quot;$cycle2&amp;quot; ];&lt;br /&gt;
then&lt;br /&gt;
# Logs killed process&lt;br /&gt;
    top -c -b -n 1 | grep &amp;quot;$cycle2&amp;quot; | grep -v grep | head -n 1 &amp;gt;&amp;gt; $archive&lt;br /&gt;
# E-mail killed process&lt;br /&gt;
    top -c -b -n 1 | grep &amp;quot;$cycle2&amp;quot; | grep -v grep | head -n 1 | mail -s &amp;quot;Excessive CPU Process killed at $HOSTNAME&amp;quot; $contact&lt;br /&gt;
# Kill the process&lt;br /&gt;
    kill -9 &amp;quot;$cycle2&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
exit 0&lt;br /&gt;
#EOF&lt;br /&gt;
&amp;lt;/bash&amp;gt;&lt;br /&gt;
[[kategoria:linux]]&lt;/div&gt;</summary>
		<author><name>KaszpiR</name></author>	</entry>

	</feed>