automatically doing some cleaning-up by the process when the systems shuts down

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Wed Mar 19 15:25:14 EDT 2008


En Wed, 19 Mar 2008 04:28:19 -0300, bharath venkatesh  
<bharathv6.project at gmail.com> escribió:

> handling SIGTERM allowed me to do cleaning up  while the system shuts  
> down
> but as i mentioned previously how can my  process know if the   system  
> was
> not shut down properly previously

Sorry about the confusion, I meant SIGTERM instead of SYSTERM.
Create a file with a known fixed name when the daemon starts, and remove  
it after a clean shutdown (you may want to write the daemon's PID). If the  
file already exists the next time it starts, that means that a clean  
shutdown was not performed.
(Note that this, and the previous question, are not specific to Python)

-- 
Gabriel Genellina




More information about the Python-list mailing list