Ok I tried this. It works as expected. You can schedule wake up timer and turn off the PC (except main power supply). And it turns on automatically at right time.
Only problem is if power goes and comes back b4 the schedule time, then PC does not start automatically.
However, my BIOS also has separate power up timer thing, if I use that then it switches on even if power goes and comes back.
So if u want to be fail safe then, make sure u use BIOS method but then u need to do it everyday.
With software based power off/on, u can schedule it automatically by minor script.
----------
TIPS
There are 3 things to consider.
1) power on time is 2AM (we will power on 2mins after 2am though)
2) 2am today or tomorrow
3) timezone
If today is 25th June 11PM and u want to schedule it tonight at 2AM...command wud be
Code:
echo `date '+%s' -d '2am next day + 332 minutes'` > /sys/class/rtc/rtc0/wakealarm
If today is 26th June 1AM and u want to schedule it tonight at 2AM...command wud be
Code:
echo `date '+%s' -d '2am + 332 minutes'` > /sys/class/rtc/rtc0/wakealarm
Here i have assumed that u r in India so timezone is +5:30 = 330minutes, 2 minutes I have added as safe margin just incase ISP time is little late.
Note: Sometimes ur BIOS's time is already in UTC mode.. in that case you dont have to add 332 minutes.
To verify that alarm time is set, run this command:
Output wud be something like this:
rtc_time : 14:23:30
rtc_date : 2011-06-25
alrm_time : 02:02:00
alrm_date : 2011-06-26
if alrm_date shows stars .. like ****-**-26 this means that its not set and time u specified has already passsed. So play around with your time by adding/subtracting ur timezone minutes.
After the success, simply turn off ur computer and have a sleep-full night!