#!/usr/bin/perl

$ENV{'PATH'} = "/bin:/usr/bin:/sbin:/usr/sbin";

print "Sending all processes the TERM signal...\n";
kill 15,-1;
sleep 3;

print "Sending all processes the KILL signal...\n";
kill 9,-1;

print "Turning off swap, and unmounting filesystems...\n";
system '/sbin/swapoff -a';
system '/sbin/umount -a';
system '/sbin/mount -n -o remount,ro /';

print "Rebooting the system.\n";
open(STDERR, ">/dev/null");
system '/sbin/reboot';
