Sunday, December 14, 2014

How to Make Any Computer Boot Up or Shut Down on a Schedule

Stopwatch on laptop keyboard. Deadline concept.
Windows, Mac OS X, and Linux all allow you to schedule boot-ups, shut-downs, and wake-ups. You can have your computer automatically power up in the morning and automatically shut down at night, if you’d like.
This is less necessary than ever thanks to sleep mode — a typical laptop just enters low-power sleep mode it can quickly resume from when it’s not being used — but may still be useful for desktop PCs.
Windows allows you to set boot-up and shutdown times through the Task Scheduler. Scheduled tasks can run the “shutdown” command, shutting down your computer at a specific time. You could also run other commands to put the computer to sleep or hibernate it. Here are the commands you’ll need:
  • Shut Down: shutdown.exe -s -t 00
  • Hibernate: rundll32.exe powrprof.dll,SetSuspendState
  • Sleep: rundll32.exe powrprof.dll,SetSuspendState 0,1,0
Through the magic of the task scheduler, you can even have Windows wait until you’re no longer using your computer to shut it down. It won’t automatically shut down on you while you’re using it if you stay up a bit late one night.
You can also create scheduled tasks that wake your computer from sleep. Assuming your computer is sleeping, and not fully shut down — you can put it to sleep yourself or use a scheduled task that puts it to sleep — this schedueld task when wake your computer up.
Mac OS X
This option is available in the System Preferences window on a Mac. Click the Apple menu, select System Preferences, and then click the Energy Saver icon in the System Preferences window.
Click the “Schedule” button at the bottom of the Energy Saver preferences and use the options here to schedule a startup or wake time for your Mac. You can also schedule a Sleep, Restart, or Shut Down time and choose which day of the week your scheduled times are used for — weekdays, weekends, a specific day, or all days of the week.
If you have a MacBook, the scheduled startup will only occur when it’s plugged in. This prevents battery drain and ensures your laptop won’t decide to boot up when it’s sitting in a bag somewhere.
The rtcwake command allows you to schedule wake-ups on Linux. This command puts your computer to sleep, hibernates it, or shuts it down while specifying a time it should wake up again. You could run the appropriate rtcwake command when you go to bed, and it will automatically boot back up at your scheduled time.
The rtcwake command can also be used just to schedule a startup time, but not to put your computer to sleep immediately. Put it to sleep or shut it down on your own schedule and it will wake up when you decide it should.
To fully automate this, you could create one or more cronjobs that run the rtcwake command at a specific time.
All types of computers can accept “Wake-On-LAN,” or WoL, magic packets. Support for Wake-on-LAN is baked into a computer at the BIOS or UEFI firmware level, below the operating system itself. When using Wake-on-LAN, a computer that’s shut down or asleep continues providing power to its network interface. This is usually a wired Ethernet connection, but you can also set a computer to accept Wake-on-LAN packets sent over Wi-Fi. When it receives an appropriately crafted packet, it will wake the computer back up again.
This option is generally enabled by default on desktop computers, but it may not be enabled on laptop computers to save battery power — especially not on the Wi-Fi interface. You’ll have to ensure Wake-on-LAN is enabled on your computer first and try it out.
Once you have Wake-on-LAN working, you could set up a device to send Wake-on-LAN packets to other devices on a  schedule. For example, we’ve covered using a router running DD-WRT to send Wake-on-LAN packets on a schedule, allowing you to wake any device from your router and configure all the wake times in one place.
By default, most computers will automatically put themselves to sleep or hibernate after a certain amount of time when they’re not being used. If you want your computer to stay running even when you’re not there, change its settings so it won’t automatically sleep or hibernate.

No comments:

Click For More Info