title: Catching system events in C Linux
body: <p>I am writing an application on Linux which requires me to catch system events like:</p>
  
  <ol>
  <li>System reboot</li>
  <li>User 'xyz' logs in</li>
  <li>'xyz' application crashes etc.</li>
  </ol>
  
  <p>and need to execute some functionality based on that. For e.g.:</p>
  
  <ol>
  <li>Run backup script</li>
  <li>Run recovery program etc.</li>
  </ol>
  
  <p>Can anyone please tell me how to catch system events in C/Linux ?</p>
  
  <p>P.S: I am not talking about 'file system' events here :P</p>