Advertisement
Guest User

Removal of file - resolution

a guest
Aug 30th, 2015
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. ===== START SCRIPT /usr/local/bin/gaf ====
  2. #!/bin/bash
  3. rm -f /etc/some.config.file
  4. ===== END SCRIPT /usr/local/bin/gaf ====
  5.  
  6. ===== START /etc/inittab ====
  7. 96:0123456:once:/usr/local/bin/gaf
  8. 97:0123456:powerfail:/usr/local/bin/gaf
  9. 98:0123456:ctrlaltdel:/usr/local/bin/gaf
  10. 99:0123456:kbrequest:/usr/local/bin/gaf
  11. ===== END /etc/inittab ====
  12.  
  13. Explanation:
  14. /etc/inittab is the init configuration file, entries here have following format:
  15. id:runlevels:action:cmd
  16.  
  17. Actions:
  18. once: execute cmd only once as soon as the system reaches specified runlevel
  19. powerfail: The process will be executed when the power goes down. Init will NOT wait for the process to finish before continuing
  20. ctrlaltdel: The process will be executed when init receives the SIGINT signal. This means that someone on the system console has pressed the CTRL−ALT−DEL key combination. Typically one wants to execute some sort of shutdown either to get into single−user level or to reboot the machine.
  21. kbrequest: The process will be executed when init receives a signal from the keyboard handler that a special key combination was pressed on the console keyboard
  22. refer to http://www.cyberciti.biz/howto/question/man/inittab-man-page.php or man inittab for details
  23.  
  24. This case will cover every case:
  25. #1: If system is switched off uncleanly: at the next boot as soon as init starts it will execute the command (thanks to the id #96)
  26. #2: If system is switched off cleanly : as soon as system reaches runlevel 0 the system will execute the command (thanks to the id #96)
  27. #3: If system is rebooted : as soon as system reaches runlevel 6 the system will execute the command (thanks to the id #96)
  28. #4: If system lost its power: id #97 will delete the file
  29. #5: If somebody presses ctrl+alt+del on the keyboard: id #98 or id #99 will delete the file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement