<?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: bkill command to kill older jobs in Administration and Deployment</title>
    <link>https://communities.sas.com/t5/Administration-and-Deployment/bkill-command-to-kill-older-jobs/m-p/695252#M20557</link>
    <description>I don't think your script would work.&lt;BR /&gt;I would do this in two steps procedure&lt;BR /&gt;Step 1: Create a a text file that has the required job names or ID&lt;BR /&gt;Step 2:Create another script to read the text file and kill the jobs.&lt;BR /&gt;</description>
    <pubDate>Thu, 29 Oct 2020 16:03:52 GMT</pubDate>
    <dc:creator>Sajid01</dc:creator>
    <dc:date>2020-10-29T16:03:52Z</dc:date>
    <item>
      <title>bkill command to kill older jobs</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/bkill-command-to-kill-older-jobs/m-p/695222#M20553</link>
      <description>&lt;P&gt;Hello Friends&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can any one help me with the command to kill bjobs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Lets says&amp;nbsp; I want to kill all jobs that are 2 days older specific with the date,time and jobs that are running on different nodes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried something like this&amp;nbsp;bjobs -u all |grep "Oct&amp;nbsp; 7" |grep&amp;nbsp; "Oct&amp;nbsp; 6" | egrep "node1|node2|node3" | awk '{print "bkill"&amp;nbsp; $1}'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;but looks like not working as expected....I want to kill all jobs specific to different date,time and executing node.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;would appreciate for all your help&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in Advance&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 15:01:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/bkill-command-to-kill-older-jobs/m-p/695222#M20553</guid>
      <dc:creator>sasprofile</dc:creator>
      <dc:date>2020-10-29T15:01:55Z</dc:date>
    </item>
    <item>
      <title>Re: bkill command to kill older jobs</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/bkill-command-to-kill-older-jobs/m-p/695252#M20557</link>
      <description>I don't think your script would work.&lt;BR /&gt;I would do this in two steps procedure&lt;BR /&gt;Step 1: Create a a text file that has the required job names or ID&lt;BR /&gt;Step 2:Create another script to read the text file and kill the jobs.&lt;BR /&gt;</description>
      <pubDate>Thu, 29 Oct 2020 16:03:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/bkill-command-to-kill-older-jobs/m-p/695252#M20557</guid>
      <dc:creator>Sajid01</dc:creator>
      <dc:date>2020-10-29T16:03:52Z</dc:date>
    </item>
    <item>
      <title>Re: bkill command to kill older jobs</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/bkill-command-to-kill-older-jobs/m-p/695258#M20558</link>
      <description>&lt;P&gt;First of all, only the superuser can kill other user's jobs.&lt;/P&gt;
&lt;P&gt;Next, this&lt;/P&gt;
&lt;PRE&gt;grep "Oct  7" |grep  "Oct  6"| &lt;/PRE&gt;
&lt;P&gt;seems to be mutually exclusive, so there will be nothing left after the second pipe&lt;/P&gt;
&lt;P&gt;Use the extended regular expression switch, and the pipe character (which does an OR in regex):&lt;/P&gt;
&lt;PRE&gt;grep -E "Oct  7|Oct  6"&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Oct 2020 16:12:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/bkill-command-to-kill-older-jobs/m-p/695258#M20558</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-10-29T16:12:12Z</dc:date>
    </item>
    <item>
      <title>Re: bkill command to kill older jobs</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/bkill-command-to-kill-older-jobs/m-p/695260#M20559</link>
      <description>&lt;P&gt;Thanks for your prompt response&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Actually this would be time consuming manually doing, which am doing curretly.&lt;/P&gt;
&lt;P&gt;am looking something with a single line command which can kill multiple jobs with different dates, time and executing nodes.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 16:18:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/bkill-command-to-kill-older-jobs/m-p/695260#M20559</guid>
      <dc:creator>sasprofile</dc:creator>
      <dc:date>2020-10-29T16:18:45Z</dc:date>
    </item>
    <item>
      <title>Re: bkill command to kill older jobs</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/bkill-command-to-kill-older-jobs/m-p/695301#M20560</link>
      <description>&lt;P&gt;so how does it would look the complete command ?&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 18:18:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/bkill-command-to-kill-older-jobs/m-p/695301#M20560</guid>
      <dc:creator>sasprofile</dc:creator>
      <dc:date>2020-10-29T18:18:14Z</dc:date>
    </item>
    <item>
      <title>Re: bkill command to kill older jobs</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/bkill-command-to-kill-older-jobs/m-p/695304#M20561</link>
      <description>&lt;P&gt;I would use a two-step approach like &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/131732"&gt;@Sajid01&lt;/a&gt;&amp;nbsp;suggested.&lt;/P&gt;
&lt;P&gt;Start by running the&lt;/P&gt;
&lt;PRE&gt;bjobs -u all&lt;/PRE&gt;
&lt;P&gt;from a FILENAME PIPE, and fetch the result into a SAS dataset. Then you can do all the logic in a SAS program, and finally write the sellected process numbers to a textfile. A periodic superuser job can then pick up the file and do the kills. Or you call the kill script with sudo from the SAS program.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 18:32:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/bkill-command-to-kill-older-jobs/m-p/695304#M20561</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-10-29T18:32:22Z</dc:date>
    </item>
    <item>
      <title>Re: bkill command to kill older jobs</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/bkill-command-to-kill-older-jobs/m-p/695309#M20563</link>
      <description>&lt;P&gt;That looks lengthy process, instead I can simply copy and paste id's on excel with filter and use bkill, but there is a single line command which does all what am requesting. I used to do it in previous company, but am not able to recollect it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Its something like similar or may be below command&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;bjobs -u all |grep -v "Oct&amp;nbsp; 7" |grep -v&amp;nbsp; "Oct&amp;nbsp; 6" | egrep "node1" | awk '{print "bkill"&amp;nbsp; $1}' &amp;gt; bkill.ksh&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;or&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;bjobs -u all |grep node1 |grep&amp;nbsp; &amp;nbsp;"Oct&amp;nbsp; 7" | awk '{print "bkill"&amp;nbsp; $1}' &amp;gt; bkill.ksh&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;ksh -x bkill.ksh&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 18:53:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/bkill-command-to-kill-older-jobs/m-p/695309#M20563</guid>
      <dc:creator>sasprofile</dc:creator>
      <dc:date>2020-10-29T18:53:11Z</dc:date>
    </item>
    <item>
      <title>Re: bkill command to kill older jobs</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/bkill-command-to-kill-older-jobs/m-p/695311#M20564</link>
      <description>&lt;P&gt;The two-step method lets me keep a record (in a dataset) of facts that led to the decision of killing. That makes the process maintainable and creates accountability.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 18:58:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/bkill-command-to-kill-older-jobs/m-p/695311#M20564</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-10-29T18:58:55Z</dc:date>
    </item>
    <item>
      <title>Re: bkill command to kill older jobs</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/bkill-command-to-kill-older-jobs/m-p/695356#M20568</link>
      <description>&lt;P&gt;What about this (you could replace the echo commands with the actual bkill command).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;#!/bin/bash
timeago='2 days ago'
bjobs -o "jobid submit_time" -u all -noheader | sed 's/ /'$'\t''/' | while IFS=$'\t' read -r jobid time
do
dtSec=$(date --date "$time" +'%s')
taSec=$(date --date "$timeago" +'%s')
if [ $dtSec -lt $taSec ] 
then
        echo "NOTE: Job $jobid was submitted over $timeago"
        echo "NOTE: You should run bkill $jobid"
fi
done&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Oct 2020 20:54:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/bkill-command-to-kill-older-jobs/m-p/695356#M20568</guid>
      <dc:creator>gwootton</dc:creator>
      <dc:date>2020-10-29T20:54:35Z</dc:date>
    </item>
    <item>
      <title>Re: bkill command to kill older jobs</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/bkill-command-to-kill-older-jobs/m-p/695371#M20570</link>
      <description>Thank you&lt;BR /&gt;But am looking for the command not exactly 2 days before,  jobs submitted before noon 1 day before all should be killed.&lt;BR /&gt;So there are multiple jobs with different dates and different times executing from different nodes</description>
      <pubDate>Thu, 29 Oct 2020 22:02:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/bkill-command-to-kill-older-jobs/m-p/695371#M20570</guid>
      <dc:creator>sasprofile</dc:creator>
      <dc:date>2020-10-29T22:02:20Z</dc:date>
    </item>
    <item>
      <title>Re: bkill command to kill older jobs</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/bkill-command-to-kill-older-jobs/m-p/695452#M20574</link>
      <description>You can modify the variable "timeago" to any date and time you wish to specify. For example, "12:00 yesterday"</description>
      <pubDate>Fri, 30 Oct 2020 12:54:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/bkill-command-to-kill-older-jobs/m-p/695452#M20574</guid>
      <dc:creator>gwootton</dc:creator>
      <dc:date>2020-10-30T12:54:24Z</dc:date>
    </item>
  </channel>
</rss>

