Depending on your system you can use the OS functions. With Linux there is cron that will allow you to schedule events and in Windows there are Scheduled Tasks. Shutting down the server will be a little tricky though.
I'm thinking this could solve the annoyance of all the spawn prisons. Let's say the last OP is leaving, but a few people are still in there building so he just leaves the server after closing the prison, knowing that the server automatically shuts down in a few hours when the other players are done for the night.