Restart OS X if an application has crashed/is not responding/beachballed? How can I automatically restart the machine if an application has crashed in any way? It might have cleanly exited, have a quit unexpectedly error, or be frozen with the spinning beachball.

I don't want to relaunch the app, but do a full restart.

Any Ideas?
Thanks.
Replace Shalalalala with the name of the process you want to monitor.

property NameOfVictim : "Shalalalala"


tell application "System Events"
    set ps to get the name of every process

    repeat while ps contains NameOfVictim
        set ps to get the name of every process
    end repeat

    restart
end tell