APC Remote Power Switch management

I’ve a APC Remote Power Switch @ home. Very usefull toy to control up to eight devices remotely via telnet or HTTP.
Anyway, I was looking for a way to automate some actions (ex: power on my backup server during the night, perform backups and power off) via crontabs but I never found the right tool.
So I wrote a small expect script which does all I need:

./apcport <port_number> [ON|OFF|SWITCH|STATUS] [DEBUG]

The command syntax is enough clear and do not need lot of documentation.
The script is available here. Feel free to download it and perform changes if needed. Now, enjoy coffie made by crontabs 🙂