I sometimes need to shutdown one of my desktop machines after a long download. I was looking for a way to do it unattendedly. I found this curious method
In short:
1. Add these alias to .bashrc
alias halt="sudo /sbin/halt"
alias reboot="sudo /sbin/reboot"
2. Edit visudo
username ALL=(ALL) NOPASSWD: /sbin/halt, /sbin/reboot
(I actually had to edit it like this in my Lenny ALL=NOPASSWD: ALL)
3. Now I just need to make sure the download finishes to power off. I use something similar to this:
wget download ; shutdown -h now
Instead of that, if I were sure about the time of the download I could use the command like this:
shutdown -h + 45 (To delay it for 45 minutes) or shutdown -h 15:30 (To delay it until half past three pm)
That's it.