<div dir="ltr"><br>I think the Thread is going somewhere else :)<div><br></div><div>OK let me explain my problem further and the Solution I came up with.</div><div><br></div><div>My Utility Read from PCRs of TPM (A hardware for a lot purposes, the PCR stores 160-bit hash and also the PCRs are volatile means on Reboot the PCRs are reseted back to Zero), Now What I want is that when my Utility Runs (Which runs manually when Ever I want) it reads from PCRs of TPM and Store those hashes in a File, And this process continues. Now the Problem is when the System Restarts, the PCR resets, so Should be the Contents of File, an easy way is to delete the File, create new one. I want my utility to know that System was reboot when since my Last Execution so that it does not append the previous Session hashes with New Ones.</div>

<div><br></div><div>The Simple Solution to know whether the System was restarted or not (And I am still wondering why I didn't came-up with it before <img src="cid:gtalk.328@goomoji.gmail" style="margin-top: 0px; margin-right: 0.2ex; margin-bottom: 0px; margin-left: 0.2ex; vertical-align: middle; " goomoji="gtalk.328"> ) is to put a check in my Utility on that PCR, If its Zero means the System was Restarted, Simply, The utility will Delete those Files, Fresh PCRs and Fresh Files.</div>

<div><br></div><div>I guess It should work.</div><div><br><div class="gmail_quote">On Thu, Apr 14, 2011 at 2:41 PM, Leo "TheHobbit" Cacciari <span dir="ltr"><<a href="mailto:leothehobbit@gmail.com">leothehobbit@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

  
    
    
  
  <div text="#000000" bgcolor="#ffffff">
    Il 04/13/2011 12:41 PM, waqar afridi ha scritto:
    <div><div></div><div class="h5"><blockquote type="cite">
      <div dir="ltr">Hello Dear List
        <div><br>
        </div>
        <div>Is there any method through which I can Detect that the
          System was recently shutdown or Restarted?</div>
        <div><br>
        </div>
        <div><b>Explanation:</b></div>
        <div><br>
        </div>
        <div>I am making a utility that will Store some Files on
          HardDisk. I want the utility to Detect if the System</div>
        <div>is newly Booted. If it is, It should delete those Files and
          Create fresh Once.<br>
        </div>
      </div>
    </blockquote></div></div>
    Hi,<br>
    someone else gave you ideas for answering the question you made, but
    given the explanation of why you made that question, I think that
    maybe you did not pose the right question. If you want to delete the
    old files and create new ones when the system is rebooted you should
    probably use a init.d script (i.e. a script installed in
    /etc/init.d). These scripts are normally invoked with a single
    argument, one of the 'commands'  start, stop, restart, reload,
    force-reload (see /etc/init.d/skeleton). <br>
    <br>
    To implement what you require, I'll write a script as above, which
    creates the files when invoked with start and deletes them when
    invoked with stop, then I'll arrange the system for call the script
    with 'start' on system start and with 'stop' when shutting down (see
    the documentation about update-rc.d for how to do it). This will
    delete the files when the system is stopped (or when it goes down
    for rebooting) and will create it again when the system comes up. <br>
    <br>
    Hoping to be of service... :)<br>
    <br>
    TH<br><font color="#888888">
    <pre cols="72">-- 
Leo "TheHobbit" Cacciari
Aliae nationes servitutem pati possunt populi romani est propria libertas</pre>
  </font></div>

<br>--<br>
ubuntu-users mailing list<br>
<a href="mailto:ubuntu-users@lists.ubuntu.com">ubuntu-users@lists.ubuntu.com</a><br>
Modify settings or unsubscribe at: <a href="https://lists.ubuntu.com/mailman/listinfo/ubuntu-users" target="_blank">https://lists.ubuntu.com/mailman/listinfo/ubuntu-users</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr"><b><font face="'comic sans ms', sans-serif"><font color="#000099"><span style="background-color:rgb(255, 255, 255)">Waqar Afridi</span></font></font></b><span style="background-color: rgb(255, 255, 255); "><font class="Apple-style-span" color="#006600"><br>

</font></span></div>
</div></div>