<?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 Help with C Shell Script - Automatically Kill process in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-c-shell-script-automatically-kill-process/m-p/2966105#M119428</link>
    <description>Hi All,&lt;BR /&gt;&lt;BR /&gt;I need some help writing a script.  I need&lt;BR /&gt;to find all processes with the words voucher&lt;BR /&gt;and then find all those user and send them&lt;BR /&gt;a wall message (to just those users)" to log out in 2 minutes" and then&lt;BR /&gt;wait 2 minutes and then kill all those tasks as super user.&lt;BR /&gt;&lt;BR /&gt;I need to kill the ppid and pid's.  I do not want to kill pid 1, and sometime these processes attach to pid 1.&lt;BR /&gt;&lt;BR /&gt;I then want to put this on the menu for my accountant to execute whenever she wants (password protected of course).&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Laurie</description>
    <pubDate>Mon, 05 May 2003 18:51:01 GMT</pubDate>
    <dc:creator>Laurie_2</dc:creator>
    <dc:date>2003-05-05T18:51:01Z</dc:date>
    <item>
      <title>Help with C Shell Script - Automatically Kill process</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-c-shell-script-automatically-kill-process/m-p/2966105#M119428</link>
      <description>Hi All,&lt;BR /&gt;&lt;BR /&gt;I need some help writing a script.  I need&lt;BR /&gt;to find all processes with the words voucher&lt;BR /&gt;and then find all those user and send them&lt;BR /&gt;a wall message (to just those users)" to log out in 2 minutes" and then&lt;BR /&gt;wait 2 minutes and then kill all those tasks as super user.&lt;BR /&gt;&lt;BR /&gt;I need to kill the ppid and pid's.  I do not want to kill pid 1, and sometime these processes attach to pid 1.&lt;BR /&gt;&lt;BR /&gt;I then want to put this on the menu for my accountant to execute whenever she wants (password protected of course).&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Laurie</description>
      <pubDate>Mon, 05 May 2003 18:51:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-c-shell-script-automatically-kill-process/m-p/2966105#M119428</guid>
      <dc:creator>Laurie_2</dc:creator>
      <dc:date>2003-05-05T18:51:01Z</dc:date>
    </item>
    <item>
      <title>Re: Help with C Shell Script - Automatically Kill process</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-c-shell-script-automatically-kill-process/m-p/2966106#M119429</link>
      <description>From the command line you can do this.&lt;BR /&gt;&lt;BR /&gt;# ps -ef | while read a b c d e f&lt;BR /&gt;&amp;gt; do&lt;BR /&gt;&amp;gt; echo kill $b&lt;BR /&gt;&amp;gt; done&lt;BR /&gt;&lt;BR /&gt;This is the 'preview' version.  When ready remove the 'echo'.&lt;BR /&gt;&lt;BR /&gt;&amp;gt; kill $b</description>
      <pubDate>Mon, 05 May 2003 19:14:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-c-shell-script-automatically-kill-process/m-p/2966106#M119429</guid>
      <dc:creator>Michael Steele_2</dc:creator>
      <dc:date>2003-05-05T19:14:00Z</dc:date>
    </item>
    <item>
      <title>Re: Help with C Shell Script - Automatically Kill process</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-c-shell-script-automatically-kill-process/m-p/2966107#M119430</link>
      <description>Here is a script I use prior to getting the backup process (I split my mirrored disks so I only need a 5 minute window of no users).&lt;BR /&gt;&lt;BR /&gt;I first kill -15 to give the application a chance to recover itself, then I do a kill -9 for those that didn't die nicely. I also take the oppurtunity to delete any run away -ksh sessions.&lt;BR /&gt;&lt;BR /&gt;I send the output of this script to a text file which I can review if need be.&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;&lt;BR /&gt;-- Rod Hills&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;# -- kick off production users prior to backup&lt;BR /&gt; echo "\07Production AVANTE backup process starts in 2 minutes\07" | /usr/sbin/wall&lt;BR /&gt; echo "System will be unavailable from 9:05 to 10:00 tonight" | /usr/sbin/wall&lt;BR /&gt; sleep 60&lt;BR /&gt; echo "\07Production AVANTE coming down in 60 seconds...\07" | /usr/sbin/wall&lt;BR /&gt; sleep 30&lt;BR /&gt; echo "\07Production AVANTE coming down in 30 seconds...\07" | /usr/sbin/wall&lt;BR /&gt; sleep 30&lt;BR /&gt; echo "\07Production AVANTE Halting !! Come back in 10 min\07" | /usr/sbin/wall&lt;BR /&gt; echo "Kill Soft Pass ..."&lt;BR /&gt; ps -ef | awk '$8=="UV"{print $0 ; system("kill -15 " $2)}'&lt;BR /&gt; sleep 30&lt;BR /&gt; echo "Kill Hard Pass ..."&lt;BR /&gt; ps -ef | awk '$8=="UV"{print $0 ; system("kill -9 " $2)}'&lt;BR /&gt; sleep 15&lt;BR /&gt; echo "Kill run away ksh Pass ..."&lt;BR /&gt; ps -ef | awk '$8=="-ksh" &amp;amp;&amp;amp; $3=="1"{print $0 ; system("kill -9 " $2)}'&lt;BR /&gt; sleep 15&lt;BR /&gt; echo "Kill Proof     ..."&lt;BR /&gt; ps -ef | awk '$8=="UV"{print $0}'&lt;BR /&gt;</description>
      <pubDate>Mon, 05 May 2003 19:42:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-c-shell-script-automatically-kill-process/m-p/2966107#M119430</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2003-05-05T19:42:59Z</dc:date>
    </item>
    <item>
      <title>Re: Help with C Shell Script - Automatically Kill process</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-c-shell-script-automatically-kill-process/m-p/2966108#M119431</link>
      <description>Here is a script I use prior to getting the backup process (I split my mirrored disks so I only need a 5 minute window of no users).&lt;BR /&gt;&lt;BR /&gt;I first kill -15 to give the application a chance to recover itself, then I do a kill -9 for those that didn't die nicely. I also take the oppurtunity to delete any run away -ksh sessions.&lt;BR /&gt;&lt;BR /&gt;I send the output of this script to a text file which I can review if need be.&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;&lt;BR /&gt;-- Rod Hills&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;# -- kick off production users prior to backup&lt;BR /&gt; echo "\07Production AVANTE backup process starts in 2 minutes\07" | /usr/sbin/wall&lt;BR /&gt; echo "System will be unavailable from 9:05 to 10:00 tonight" | /usr/sbin/wall&lt;BR /&gt; sleep 60&lt;BR /&gt; echo "\07Production AVANTE coming down in 60 seconds...\07" | /usr/sbin/wall&lt;BR /&gt; sleep 30&lt;BR /&gt; echo "\07Production AVANTE coming down in 30 seconds...\07" | /usr/sbin/wall&lt;BR /&gt; sleep 30&lt;BR /&gt; echo "\07Production AVANTE Halting !! Come back in 10 min\07" | /usr/sbin/wall&lt;BR /&gt; echo "Kill Soft Pass ..."&lt;BR /&gt; ps -ef | awk '$8=="UV"{print $0 ; system("kill -15 " $2)}'&lt;BR /&gt; sleep 30&lt;BR /&gt; echo "Kill Hard Pass ..."&lt;BR /&gt; ps -ef | awk '$8=="UV"{print $0 ; system("kill -9 " $2)}'&lt;BR /&gt; sleep 15&lt;BR /&gt; echo "Kill run away ksh Pass ..."&lt;BR /&gt; ps -ef | awk '$8=="-ksh" &amp;amp;&amp;amp; $3=="1"{print $0 ; system("kill -9 " $2)}'&lt;BR /&gt; sleep 15&lt;BR /&gt; echo "Kill Proof     ..."&lt;BR /&gt; ps -ef | awk '$8=="UV"{print $0}'&lt;BR /&gt;</description>
      <pubDate>Mon, 05 May 2003 19:46:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-c-shell-script-automatically-kill-process/m-p/2966108#M119431</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2003-05-05T19:46:11Z</dc:date>
    </item>
    <item>
      <title>Re: Help with C Shell Script - Automatically Kill process</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-c-shell-script-automatically-kill-process/m-p/2966109#M119432</link>
      <description>Hi, Laurie&lt;BR /&gt;&lt;BR /&gt;1.- The wall command up to HP-UX 10.20 is for groups not users, so the first think you must do is to create a group for each user, so each group has only one user. (see man wall)&lt;BR /&gt;&lt;BR /&gt;2.- Create 2 scripts, you can put them in /usr/local/bin or something similar. The first one is only one line that calls the other one.&lt;BR /&gt;first script:&lt;BR /&gt;su -c /usr/local/bin/2nd_script&lt;BR /&gt;&lt;BR /&gt;This way the root password will be demanded to execute the second script.&lt;BR /&gt;&lt;BR /&gt;I attach you this 2nd script.&lt;BR /&gt;&lt;BR /&gt;Be careful to put the chmod 755 to the scripts to make it executables.&lt;BR /&gt;&lt;BR /&gt;Edit the script and make the correct changes, mainly in the user groups initialization and the message sent to the users.&lt;BR /&gt;&lt;BR /&gt;3.- To put in the screen menu you must edit the file in home users ~/.dt/dtwmrc and add an entry in the Root Menu.&lt;BR /&gt;&lt;BR /&gt;Frank.</description>
      <pubDate>Tue, 06 May 2003 09:06:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-c-shell-script-automatically-kill-process/m-p/2966109#M119432</guid>
      <dc:creator>Francisco J. Soler</dc:creator>
      <dc:date>2003-05-06T09:06:18Z</dc:date>
    </item>
  </channel>
</rss>

