<?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: exiting a program in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/exiting-a-program/m-p/2587171#M725565</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;within your script you can kill the login shell with:&lt;BR /&gt;&lt;BR /&gt;kill -9 `who am i -T|awk '{print $8}'`&lt;BR /&gt;&lt;BR /&gt;Regards</description>
    <pubDate>Sat, 29 Sep 2001 19:02:12 GMT</pubDate>
    <dc:creator>Andreas Voss</dc:creator>
    <dc:date>2001-09-29T19:02:12Z</dc:date>
    <item>
      <title>exiting a program</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/exiting-a-program/m-p/2587169#M725563</link>
      <description>Hello all,&lt;BR /&gt;&lt;BR /&gt;I'm writing a shell script that when it exits to log off the user that started it(Posix shell if it matters in this case).  There isn't a command to logoff or exit that I could call that I've found. &lt;BR /&gt;Thanks in advance,</description>
      <pubDate>Sat, 29 Sep 2001 18:15:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/exiting-a-program/m-p/2587169#M725563</guid>
      <dc:creator>Dennis Kennedy</dc:creator>
      <dc:date>2001-09-29T18:15:29Z</dc:date>
    </item>
    <item>
      <title>Re: exiting a program</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/exiting-a-program/m-p/2587170#M725564</link>
      <description>Hi Dennis:&lt;BR /&gt;&lt;BR /&gt;If your script is one that you want to launch when the user logs in, and when it exits, the user is logged off, then their our two easy ways.  These methods are well suited with menu-based scripts.&lt;BR /&gt;&lt;BR /&gt;One method is to launch your script as the last command of the user's login profile, as:&lt;BR /&gt;&lt;BR /&gt;# exec $HOME/my.script&lt;BR /&gt;&lt;BR /&gt;The other method is to declare the script as the program to use in lieu of the normal shell in the sixth field of the user's /etc/passwd entry.&lt;BR /&gt;&lt;BR /&gt;In either case, when the script exits, the user will be logged-off.&lt;BR /&gt;&lt;BR /&gt;The advantage to the second method (making the default shell be your script) is that the user cannot escape into a shell from within your script.  Remember that simple commands like 'more" have this ability, and you may want to restict that for security reasons.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Sat, 29 Sep 2001 18:43:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/exiting-a-program/m-p/2587170#M725564</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2001-09-29T18:43:18Z</dc:date>
    </item>
    <item>
      <title>Re: exiting a program</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/exiting-a-program/m-p/2587171#M725565</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;within your script you can kill the login shell with:&lt;BR /&gt;&lt;BR /&gt;kill -9 `who am i -T|awk '{print $8}'`&lt;BR /&gt;&lt;BR /&gt;Regards</description>
      <pubDate>Sat, 29 Sep 2001 19:02:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/exiting-a-program/m-p/2587171#M725565</guid>
      <dc:creator>Andreas Voss</dc:creator>
      <dc:date>2001-09-29T19:02:12Z</dc:date>
    </item>
    <item>
      <title>Re: exiting a program</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/exiting-a-program/m-p/2587172#M725566</link>
      <description>Hi Dennis,&lt;BR /&gt;&lt;BR /&gt;I second Jim's option of defining the user's shell as the script, but if that is not an option, then what you can do is when the user logs in and runs the script, as the last thing do a kill on the PPID which would be the shell which spawns this script. If you are spawning lots of other child processes then i would recommend storing the PPID early on in the script to a variable and then do a kill on that variable as the last thing in the script.&lt;BR /&gt;&lt;BR /&gt;-HTH&lt;BR /&gt;Ramesh</description>
      <pubDate>Sat, 29 Sep 2001 19:07:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/exiting-a-program/m-p/2587172#M725566</guid>
      <dc:creator>linuxfan</dc:creator>
      <dc:date>2001-09-29T19:07:20Z</dc:date>
    </item>
    <item>
      <title>Re: exiting a program</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/exiting-a-program/m-p/2587173#M725567</link>
      <description>Thank you all for your help.  I'm sure that both processes would work but I decided with the kill.  I'm making a "User friendly" menu for some of our users and I need the environment settings in the .profile.&lt;BR /&gt;&lt;BR /&gt;Thanks again!!&lt;BR /&gt;(I'll have a crown some day!! LOL)</description>
      <pubDate>Sat, 29 Sep 2001 19:40:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/exiting-a-program/m-p/2587173#M725567</guid>
      <dc:creator>Dennis Kennedy</dc:creator>
      <dc:date>2001-09-29T19:40:50Z</dc:date>
    </item>
    <item>
      <title>Re: exiting a program</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/exiting-a-program/m-p/2587174#M725568</link>
      <description>Hi (again) Dennis:&lt;BR /&gt;&lt;BR /&gt;One last point:&lt;BR /&gt;&lt;BR /&gt;If you want your shell to have the environmental variables of its $HOME/.profile, then the 'exec' mechanism I first suggested would provide that.  In addition, if your script wanted to offer the ability to "shell-out", it could.  Having done so, the user could execute commands in the subshell and upon exiting the subshell, return to your script.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Sat, 29 Sep 2001 20:05:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/exiting-a-program/m-p/2587174#M725568</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2001-09-29T20:05:54Z</dc:date>
    </item>
  </channel>
</rss>

