On Saturday, May 18, 2002, at 10:11 , loan tran wrote:
[..]
> I still seem can not figure out the answer for
> question #2 by myself. Can you please help?
> Thanks.

the only way to keep state between reboots is
to write volitile memory to a persistent storage in some
place which will survive the reboot.


The simplest form of this would be to a file on the host
in a place not likely to be cleaned with the reboot
  eg: not in /tmp
as it will get cleaned on most *nix systems.

So what you will want to do is have a

        my $cache_file = "/my/happy/place/${programme}.cache.file";

and in the sigTERM handler take the state of the logfile -
eg say curpos - and just whack it into the $cache_file.
{ not that unless the logfile to be grovelled gets truncated
as a part of the reboot cycle - not a bad idea really -
then you should be styling. }

Then when started up again - have your daemon check for
the existence of the persistent storage value - and
validate that that the file itself is at least that size
or larger - munch off that bit - and drop into your
main 'grovelTillToldOtherWise' loop....

Alternatively you could use an LDAP server, remote database,
or any of a variety of networked persistent storage solutions.

ciao
drieux

---
questions not to ask in job interviews:

        "Why are you shipping that off to a database?
        Why not simply persist that Java Object Locally
                since you can save on the network overhead, as you
                        are merely updating it and do not have any architectural
                                design or requirement for archival data not current
                                        in the Java Object itself?"

these things can confuse folks...


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to