<?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 Modify script in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/modify-script/m-p/5663451#M53683</link>
    <description>&lt;P&gt;in my linux system , we have a program ( it is a binary program , I do not have the source code ) which will do something in the database . In the program , there is a exit function , when select exit , it will quit the program and go to linux shell , this program works fine.&lt;/P&gt;&lt;P&gt;Now , I would like to do modify for this program -- I would like to send out a mail to me once quitted this program , but how to know (detect) the program is quitted ?&lt;/P&gt;&lt;P&gt;thx&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;** may be my question is not clear enough , I will reply it if anything is not clear.&lt;/P&gt;</description>
    <pubDate>Mon, 21 May 2012 08:51:43 GMT</pubDate>
    <dc:creator>Intothenewworld</dc:creator>
    <dc:date>2012-05-21T08:51:43Z</dc:date>
    <item>
      <title>Modify script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/modify-script/m-p/5663451#M53683</link>
      <description>&lt;P&gt;in my linux system , we have a program ( it is a binary program , I do not have the source code ) which will do something in the database . In the program , there is a exit function , when select exit , it will quit the program and go to linux shell , this program works fine.&lt;/P&gt;&lt;P&gt;Now , I would like to do modify for this program -- I would like to send out a mail to me once quitted this program , but how to know (detect) the program is quitted ?&lt;/P&gt;&lt;P&gt;thx&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;** may be my question is not clear enough , I will reply it if anything is not clear.&lt;/P&gt;</description>
      <pubDate>Mon, 21 May 2012 08:51:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/modify-script/m-p/5663451#M53683</guid>
      <dc:creator>Intothenewworld</dc:creator>
      <dc:date>2012-05-21T08:51:43Z</dc:date>
    </item>
    <item>
      <title>Re: Modify script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/modify-script/m-p/5663465#M53684</link>
      <description>&lt;P&gt;(This is a HP-UX board, not Linux.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;I would like to do modify for this program&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can't, you don't have the source.&amp;nbsp; You could modify the script.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;I would like to send out a mail to me once quitted this program but how to know (detect) the program is quitted?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All you can know is the exit status, $? for a real shell.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 21 May 2012 09:07:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/modify-script/m-p/5663465#M53684</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2012-05-21T09:07:37Z</dc:date>
    </item>
    <item>
      <title>Re: Modify script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/modify-script/m-p/5664371#M53686</link>
      <description>&lt;P&gt;You can try to pre-load a shared library which registers an atexit routine, just like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;$ cat hello.c&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;#include &amp;lt;stdio.h&amp;gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;#include &amp;lt;stdlib.h&amp;gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;int main (void) {&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; printf ("%s, hello\n", __func__);&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; exit (EXIT_SUCCESS);&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;}&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;$ make hello&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;cc &amp;nbsp; &amp;nbsp; hello.c &amp;nbsp; -o hello&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;$ ./hello&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;main, hello&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;$&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;$ cat addatexit.c&amp;nbsp;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;#include &amp;lt;stdio.h&amp;gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;void myexit(void) {&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; printf ("%s, here we are\n",__func__);&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;}&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;static void __attribute__((constructor)) init() {&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; atexit(myexit);&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;}&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;$ cc -o addatexit -shared addatexit.c&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;$ LD_PRELOAD=./addatexit ./hello&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;main, hello&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;myexit, here we are&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;$&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 21 May 2012 20:06:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/modify-script/m-p/5664371#M53686</guid>
      <dc:creator>H.Becker</dc:creator>
      <dc:date>2012-05-21T20:06:19Z</dc:date>
    </item>
  </channel>
</rss>

