<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: help for runaway script. in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/help-for-runaway-script/m-p/2819190#M86211</link>
    <description>Hi&lt;BR /&gt;&lt;BR /&gt;You can grep for the defunct process ( run away process) and kill them ..&lt;BR /&gt;#ps -ef | grep dfunct&lt;BR /&gt;&lt;BR /&gt;# kill (PID) of the dfunct&lt;BR /&gt;&lt;BR /&gt;James&lt;BR /&gt;</description>
    <pubDate>Fri, 04 Oct 2002 15:25:10 GMT</pubDate>
    <dc:creator>James George_1</dc:creator>
    <dc:date>2002-10-04T15:25:10Z</dc:date>
    <item>
      <title>help for runaway script.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-for-runaway-script/m-p/2819187#M86208</link>
      <description>Team:&lt;BR /&gt;&lt;BR /&gt; We want to create a script for killing application runaway processes. (the user logs from PC thru xemulator and we constantly having runaway). There were several useful suggestions in the forums yesterday for my question on the same lines. This would be a temporary solution but we need to implement this ASAP. What we are trying to do is automate the manual stuff which the SA is doing. These are the steps the SA does..&lt;BR /&gt;1. run top (to identify the runaway)&lt;BR /&gt;2. monitor the process which are more than 90% for 25 minutes (only aplication processes)&lt;BR /&gt;3. If after 25 minutes if it stays over 90% then it would be killed with a -6 flag(to produce a core) and then -15 and if not -9.&lt;BR /&gt; These are the steps followed. Please give your valuable ideas.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Ben</description>
      <pubDate>Fri, 04 Oct 2002 12:32:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-for-runaway-script/m-p/2819187#M86208</guid>
      <dc:creator>ben_43</dc:creator>
      <dc:date>2002-10-04T12:32:03Z</dc:date>
    </item>
    <item>
      <title>Re: help for runaway script.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-for-runaway-script/m-p/2819188#M86209</link>
      <description>Check this nearly identical question:&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x2573402f24d5d61190050090279cd0f9,00.html" target="_blank"&gt;http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x2573402f24d5d61190050090279cd0f9,00.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Fri, 04 Oct 2002 12:52:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-for-runaway-script/m-p/2819188#M86209</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2002-10-04T12:52:24Z</dc:date>
    </item>
    <item>
      <title>Re: help for runaway script.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-for-runaway-script/m-p/2819189#M86210</link>
      <description>This script checks for a runaway BAAAN process.&lt;BR /&gt;&lt;BR /&gt;Just modify the process you want, as well as add a kill command if you like...&lt;BR /&gt;&lt;BR /&gt;Just cron it for say every 5 minutes...&lt;BR /&gt;&lt;BR /&gt;Rgds...Geoff&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;#&lt;BR /&gt;# Script to monitor runaway processess&lt;BR /&gt;# The ba6.1 process should never accumulate more then a few seconds&lt;BR /&gt;# of cpu time.  This helps to determine runaway processess&lt;BR /&gt;# Geoff Wild Feb 16, 1998&lt;BR /&gt;#&lt;BR /&gt;#&lt;BR /&gt;# log file: /tmp/runaways.log&lt;BR /&gt;logfile=/tmp/runaways.log&lt;BR /&gt;if [ -f $logfile ];&lt;BR /&gt;then&lt;BR /&gt;        rm $logfile&lt;BR /&gt;        touch $logfile&lt;BR /&gt;else&lt;BR /&gt;        touch $logfile&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;echo "/scripts/runaways\n "&amp;gt;$logfile 2&amp;gt;&amp;amp;1&lt;BR /&gt;&lt;BR /&gt;#This next line checks the cpu time (field 7 in a ps -ef) and if greater&lt;BR /&gt;#then 1 minute, warns admin&lt;BR /&gt;&lt;BR /&gt;for i in `ps -ef|grep ba6.1|awk '$7 &amp;gt; 1 {print $1}'`&lt;BR /&gt;do&lt;BR /&gt;echo `ps -ef|grep ba6.1|awk '$7 &amp;gt; 1 {print $0}'`&amp;gt;&amp;gt;$logfile 2&amp;gt;&amp;amp;1&lt;BR /&gt;        mailx -s "Check Runaway(s)" `cat /scripts/mailadmin.list` &amp;lt;$logfile&lt;BR /&gt;done&lt;BR /&gt;</description>
      <pubDate>Fri, 04 Oct 2002 14:35:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-for-runaway-script/m-p/2819189#M86210</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2002-10-04T14:35:51Z</dc:date>
    </item>
    <item>
      <title>Re: help for runaway script.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-for-runaway-script/m-p/2819190#M86211</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;You can grep for the defunct process ( run away process) and kill them ..&lt;BR /&gt;#ps -ef | grep dfunct&lt;BR /&gt;&lt;BR /&gt;# kill (PID) of the dfunct&lt;BR /&gt;&lt;BR /&gt;James&lt;BR /&gt;</description>
      <pubDate>Fri, 04 Oct 2002 15:25:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-for-runaway-script/m-p/2819190#M86211</guid>
      <dc:creator>James George_1</dc:creator>
      <dc:date>2002-10-04T15:25:10Z</dc:date>
    </item>
    <item>
      <title>Re: help for runaway script.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-for-runaway-script/m-p/2819191#M86212</link>
      <description>Hi Ben,&lt;BR /&gt;&lt;BR /&gt;This could be the makings of what you want:&lt;BR /&gt;&lt;BR /&gt;#!/opt/perl5/bin/perl&lt;BR /&gt;&lt;BR /&gt;$TOP="/usr/bin/top";&lt;BR /&gt;$file="/tmp/top.out";&lt;BR /&gt;&lt;BR /&gt;$interval=25;&lt;BR /&gt;$limit=90;&lt;BR /&gt;&lt;BR /&gt;while ( true ) {&lt;BR /&gt; unlink $file if ( -e $file ) ;&lt;BR /&gt; system("$TOP -d 1 -f $file");&lt;BR /&gt; $head=0;&lt;BR /&gt; open FH,"$file";&lt;BR /&gt; undef %pids;&lt;BR /&gt; while (&lt;FH&gt;) {&lt;BR /&gt;  chomp;&lt;BR /&gt;  $head=1,next if (/COMMAND/);&lt;BR /&gt;  next unless $head;&lt;BR /&gt;  @a=split;&lt;BR /&gt;  $pid=$a[1];&lt;BR /&gt;  $cpu=$a[10];&lt;BR /&gt;  $totcpu{$pid}+=$cpu;&lt;BR /&gt;  $entries{$pid}++;&lt;BR /&gt;  $pids{$pid}=1;&lt;BR /&gt; }&lt;BR /&gt; foreach $pid (keys %totcpu) {&lt;BR /&gt;  if ( ! defined $pids{$pid} ) {&lt;BR /&gt;   delete $totcpu{$pid};&lt;BR /&gt;   delete $entries{$pid};&lt;BR /&gt;   next;&lt;BR /&gt;  }&lt;BR /&gt;  print "PID=$pid, #entries=$entries{$pid}, #tot cpu=$totcpu{$pid}\n";&lt;BR /&gt;  if ($entries{$pid} == $interval){&lt;BR /&gt;   $ave=$totcpu{$pid}/$interval;&lt;BR /&gt;   if ( $ave &amp;gt; $limit ) {&lt;BR /&gt;    print "ERROR: PID $pid has an average CPU over past $interval minutes of &amp;gt; $limit%\n";&lt;BR /&gt;   }&lt;BR /&gt;   delete $totcpu{$pid};&lt;BR /&gt;   delete $entries{$pid};&lt;BR /&gt;  }&lt;BR /&gt; }&lt;BR /&gt; print "Sleeping for 1 minute\n";&lt;BR /&gt; sleep 60;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Basically, this runs a top every minute, and stores the top %cpu and pids in a couple of arrays.  Once a process has racked up 25 entries, i.e. 25 minutes worth of data, the average CPU is calculated, and an error printed if &amp;gt; 90%.  Obviously you'd substitute code to perform the kills.  If a process is not there at the next poll interval, it's removed from the array.  Anyway, try this, it's not destructive, and it's got a bit of debug code in there too.&lt;BR /&gt;&lt;BR /&gt;Rgds, Robin&lt;/FH&gt;</description>
      <pubDate>Fri, 04 Oct 2002 15:40:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-for-runaway-script/m-p/2819191#M86212</guid>
      <dc:creator>Robin Wakefield</dc:creator>
      <dc:date>2002-10-04T15:40:36Z</dc:date>
    </item>
  </channel>
</rss>

