There are many ways to skin this cat, but as an alternative to what you were asking it might prove more elegant to let cron turn the machine off according to schedule. Specifically, put the following into a file in /etc/cron.d/
One advantage of doing it this way is that you could customise the schedule if, say, you wanted it to remain on later at the weekends etc.
# Cron job to turn the machine off at 2300hrs every night
# Send any error output to root for fault diagnosis
# (STDOUT will be redirected to /dev/null)
# Actual schedule/command
# Format: Min Hr DayofMth Mth DayofWk User Command
00 23 * * * root shutdown > /dev/null