Shutdown the Linux server if no one is using the server

Hi All,

I want to shutdown the server if no one is actualy using it. Its a linux server.

I thought of sending a msg on users terminal for those who all are logged in and expecting a input from them.

If they will reply system should not get shutdown else it should not.

Can any one help me on this. How can i implement this using Shell scripting.

Thanks in advance.

man who

I am able to get the users who all are logged in, but not getting how to send the message to those specific users only and get the input int return so that i can decide on that basis whether to shutdown or not.