Evoking a restart even if programmes hang using Applescript

My server hangs at times and I would like to be able to send it a command per email that would trigger a restart or for that matter any other way of restarting it. Any thoughts of doing this without having to put the password of a super user or user in the script? Thanks

In Apple Mail there are rules under the preferences menu. The action for a mail rule, one of them, is to run an applescript. So basically you can set up a rule such that when your computer receives an email from you with a certain subject (known only to you) then your applescript is run. The applescript can do anything you want like restart your computer. I’m not sure how well it would work if your computer is “hung” but you can give it a try. There are some shell script commands that might help with a hung process.

If you do a search for mail rules on this website I’m sure you’d find examples.

You can keep your password in your keychain, then in your applescript you search the keychain and retrieve the password. This way you don’t need to keep passwords in your scripts. I posted a script that I use here in post #2http://macscripter.net/viewtopic.php?id=23977

Here’s an article talking about this… http://www.red-sweater.com/blog/170/usable-keychain-scripting

thanks will give it a go, and yes I did know you could put rules in Apple Mail to trigger scripts, I control a number of functions this way on my server.