When critical operation fails

I did not write this code, but It’s very interesting and thought of sharing.


if (critical_operation() == FAILED) {
/* Uh oh. Quick, we need a distraction! */
switch((rand() % 4)) {
case 0: blame = "killall -SEGV kick_watchdog"; break;
case 1: blame = "killall -ABRT cli_process"; break;
case 2: blame = "cat /dev/urandom >/proc/kmem"; break;
case 3: blame = "killall -FPE hardware_manager"; break;
}
system(blame);
system("rm /var/log/*.log"); /* Destroy the evidence */
sleep(10); /* Wait for the other process to die first */
return;
}
Categories: Scripts

Comments (1)

Leave a Reply

Your email address will not be published. Required fields are marked *

*