Automatic Turn On/Off PC and Modem

  • Thread starter Thread starter cupid
  • Start date Start date
  • Replies Replies 15
  • Views Views 6,076

cupid

Newbie
Messages
13
Location
NA
ISP
BSNL
I use both linux( Ububtu 9.10 and after) and Windows( Xp ) Os's to browse web.I use night unlimited scheme (2-8 am) broadband plan...The situation is Every night i have to get up at nearby 2am and then wake up and sit in front of PC till 8am ... to shut down my modem at 8am... This is very hectic... Is there any way so that i can automate the process turn on/off my pc and modem i.e., turn on automatically and then connect to my internet connection.. and then shut down at 8am...I use both linux & windows... So if possible can some one... suggest me anything..
 
Solution for linux:

For shutting down its very easy... you can either have a cron job to shutdown daily at 8AM. Your use at command to schedule shutdown at 8AM.

For waking up:
See this article, you need BIOS which supports RTC alarm. (most BIOS after 2000 support it)
ACPI Wakeup - MythTV Official Wiki

Steps to verify if your BIOS supports this is also given there.
 
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:
Code:
cat /proc/driver/rtc
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!
 
I tried setting the RTC Alarm from BIOS under Power management... I choosed the date to be everyday and did the time setting too... then shutdown...But the alarm did not rang... still running XP
 
Dont do both. Just try BIOS one, if it works then good.Some BIOS are buggy, when u say RTC alarm enabled it actually disables it and when u say disable, it enables it! So try reverse.Basically u need to do some R&D urself. It def. works as expected on precise time.Running XP means? How will alarm ring when its already running?
 
"still running XP" means right now i am using XP... okk... now i need to know one thing... Do i need to hibernate my PC or just shut down. For the alarm to work properly ?Also does it matter in case of RTC alarm as which OS i am using ??
 
I tried using shutdown as well as hibernate.RTC alarm will turn on ur machine and ur machine will boot in to default OS (if u have dual boot system)
 
Back