<?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: Modify the script in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/modify-the-script/m-p/3456001#M15757</link>
    <description>Sorry, ignore my previous reply. It was wrong. &lt;BR /&gt;&lt;BR /&gt;One way to fix it is to declare TIMEOUT as an integer in the beginning like this.&lt;BR /&gt;typeset -i TIMEOUT&lt;BR /&gt;TIMEOUT=40&lt;BR /&gt;&lt;BR /&gt;Chris</description>
    <pubDate>Wed, 05 Jan 2005 11:37:08 GMT</pubDate>
    <dc:creator>Chris Xu</dc:creator>
    <dc:date>2005-01-05T11:37:08Z</dc:date>
    <item>
      <title>Modify the script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/modify-the-script/m-p/3455998#M15754</link>
      <description>Sorry to  ask  the  innocent question ,  I have the below script that run  very fine at unx  can't fail in linux  box , could suggest how can I modify it to make it also work  at linux box ,  very thanks if anyone can help . &lt;BR /&gt;&lt;BR /&gt;the script: &lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;&lt;BR /&gt;PATH=$PATH:/usr/bin:/usr/sbin:/usr/contrib/bin&lt;BR /&gt;TIMEOUT=40&lt;BR /&gt;EXCEPTIONLIST=~/etc/exception.lst&lt;BR /&gt;touch $EXCEPTIONLIST&lt;BR /&gt;&lt;BR /&gt;kill_pid()&lt;BR /&gt;{&lt;BR /&gt;PID=$1&lt;BR /&gt;kill -9 $PID&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;echo "User:Activity:PID:Status" &lt;BR /&gt;who -u | while read line&lt;BR /&gt;do&lt;BR /&gt;time=$(echo $line | awk '{print $6}')&lt;BR /&gt;pid=$(echo $line | awk '{print $7}')&lt;BR /&gt;user=$(echo $line | awk '{print $1}')&lt;BR /&gt;&lt;BR /&gt;grep -q "^${user}:" $EXCEPTIONLIST&lt;BR /&gt;if [ $? != 0 ]&lt;BR /&gt;then&lt;BR /&gt;if [ "$time" = "old" ]&lt;BR /&gt;then&lt;BR /&gt;(( time = $TIMEOUT + 1 ))&lt;BR /&gt;else&lt;BR /&gt;echo $time |grep -q "\."&lt;BR /&gt;if [ $? != 0 ]&lt;BR /&gt;then&lt;BR /&gt;time=$(echo $time|awk '{FS=":";print $1*60+$2}')&lt;BR /&gt;else&lt;BR /&gt;time=0&lt;BR /&gt;fi&lt;BR /&gt;fi&lt;BR /&gt;fi&lt;BR /&gt;#echo $time&lt;BR /&gt;if [ $time -gt $TIMEOUT ]&lt;BR /&gt;then&lt;BR /&gt;echo "$user:$time:$pid:Killed"&lt;BR /&gt;&lt;BR /&gt;# Uncomment to do kill that PID&lt;BR /&gt;kill_pid $pid&lt;BR /&gt;else&lt;BR /&gt;echo "$user:$time:$pid:Untouched"&lt;BR /&gt;fi&lt;BR /&gt;done &lt;BR /&gt;&lt;BR /&gt;______________________________________________________&lt;BR /&gt;&lt;BR /&gt;the error is &lt;BR /&gt;./kill_idle: line 38: [: 00:03: integer expression expected , where line 38 is "if [ $time -gt $TIMEOUT ]"</description>
      <pubDate>Wed, 05 Jan 2005 10:50:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/modify-the-script/m-p/3455998#M15754</guid>
      <dc:creator>peterchu</dc:creator>
      <dc:date>2005-01-05T10:50:22Z</dc:date>
    </item>
    <item>
      <title>Re: Modify the script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/modify-the-script/m-p/3455999#M15755</link>
      <description>You can replace -gt with &amp;gt; like below:&lt;BR /&gt;&lt;BR /&gt;old: "if [ $time -gt $TIMEOUT ]" &lt;BR /&gt;&lt;BR /&gt;new: "if [ $time &amp;gt; $TIMEOUT ]" &lt;BR /&gt;&lt;BR /&gt;Chris</description>
      <pubDate>Wed, 05 Jan 2005 11:23:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/modify-the-script/m-p/3455999#M15755</guid>
      <dc:creator>Chris Xu</dc:creator>
      <dc:date>2005-01-05T11:23:09Z</dc:date>
    </item>
    <item>
      <title>Re: Modify the script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/modify-the-script/m-p/3456000#M15756</link>
      <description>I copied and pasted it to in to my test machine-works fine.&lt;BR /&gt;had to create etc folder under  user's home.&lt;BR /&gt;I have fedora 3.....&lt;BR /&gt;Regards.</description>
      <pubDate>Wed, 05 Jan 2005 11:26:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/modify-the-script/m-p/3456000#M15756</guid>
      <dc:creator>Alexander Chuzhoy</dc:creator>
      <dc:date>2005-01-05T11:26:04Z</dc:date>
    </item>
    <item>
      <title>Re: Modify the script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/modify-the-script/m-p/3456001#M15757</link>
      <description>Sorry, ignore my previous reply. It was wrong. &lt;BR /&gt;&lt;BR /&gt;One way to fix it is to declare TIMEOUT as an integer in the beginning like this.&lt;BR /&gt;typeset -i TIMEOUT&lt;BR /&gt;TIMEOUT=40&lt;BR /&gt;&lt;BR /&gt;Chris</description>
      <pubDate>Wed, 05 Jan 2005 11:37:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/modify-the-script/m-p/3456001#M15757</guid>
      <dc:creator>Chris Xu</dc:creator>
      <dc:date>2005-01-05T11:37:08Z</dc:date>
    </item>
  </channel>
</rss>

