<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<title></title>
</head>
<body text="#000000" bgcolor="#ffffff">
Il 04/13/2011 12:41 PM, waqar afridi ha scritto:
<blockquote
cite="mid:BANLkTimHf4TUAEtYCOWk03XXwfRVV-N_AA@mail.gmail.com"
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>
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>
<pre class="moz-signature" cols="72">--
Leo "TheHobbit" Cacciari
Aliae nationes servitutem pati possunt populi romani est propria libertas</pre>
</body>
</html>