Detecting System Restart or Shutdown?
waqar afridi
afridi.waqar at gmail.com
Thu Apr 14 11:13:05 UTC 2011
I think the Thread is going somewhere else :)
OK let me explain my problem further and the Solution I came up with.
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.
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 [?] ) 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.
I guess It should work.
On Thu, Apr 14, 2011 at 2:41 PM, Leo "TheHobbit" Cacciari <
leothehobbit at gmail.com> wrote:
> Il 04/13/2011 12:41 PM, waqar afridi ha scritto:
>
> Hello Dear List
>
> Is there any method through which I can Detect that the System was
> recently shutdown or Restarted?
>
> *Explanation:*
>
> I am making a utility that will Store some Files on HardDisk. I want the
> utility to Detect if the System
> is newly Booted. If it is, It should delete those Files and Create fresh
> Once.
>
> Hi,
> 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).
>
> 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.
>
> Hoping to be of service... :)
>
> TH
>
> --
> Leo "TheHobbit" Cacciari
> Aliae nationes servitutem pati possunt populi romani est propria libertas
>
>
> --
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
>
>
--
*Waqar Afridi*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20110414/6a0ce567/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 328.png
Type: image/png
Size: 569 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20110414/6a0ce567/attachment.png>
More information about the ubuntu-users
mailing list