Fastest way to drain battery

14

8

I'm using Mac OS X 10.7.1 on a Macbook Core 2 Duo.
What's the fastest way of draining the battery without crashing the system and preferable by using some sort of a script?

Tyilo

Posted 2011-08-21T06:47:55.740

Reputation: 2 345

1Convert videos. Lots of them. In HD. – Soumya – 2011-08-21T06:54:10.830

Run SETI@home (or other BOINC projects) on it: http://setiathome.berkeley.edu/

– Randolf Richardson – 2011-08-21T06:57:11.217

@Randolf is this similiar to Folding@home? – Tyilo – 2011-08-21T07:00:47.583

@Tyilo: If that's part of the BOINC system, then "yes, it is." I only participate in the SETI project (which I believe is what inspired so many of these distributed computing projects to start). – Randolf Richardson – 2011-08-21T07:02:38.197

@Randolf SETI looks for alien signals by doing analysis of information from radio telescopes but the technology is similar to that of Folding@Home. – Col – 2011-08-21T08:10:10.767

NOTE: This question is applicable to Linux systems as well. The answer using the yes command worked on my Fedora laptop! – slm – 2012-01-09T17:07:09.393

Answers

33

Keeping your CPU's busy can be done with a script. Just run the following in 2 consoles:

yes > /dev/null

If you have more than 2 CPU's you need to run it in more consoles. Another option is to write a slightly more complicated script that uses multiprocessing but this is the simplest thing that will max out your CPUs.

suweller

Posted 2011-08-21T06:47:55.740

Reputation: 467

This is great, thanks! I also am taking the opportunity to rebuild by spotlight index as well as scan for viruses. Combined I've gone from like 6-hours-to-discharge to just over 2. – Bane – 2014-08-05T02:05:42.993

4The "yes" command should be upgraded to a multi-threaded version. ;-P – Randolf Richardson – 2011-08-21T23:03:29.947

This certainly maxes out the processor in a pretty quick and easy script. – alimack – 2011-09-01T13:16:07.350

6IF you have two cpu's use yes > /dev/null & yes > /dev/null – Tyilo – 2012-01-09T17:11:12.600

2This worked under Linux too! – slm – 2012-01-09T18:57:37.857

5

If you can run utilities that cause moving parts to work, then that should drain a the battery fairly quickly. Writing CDs or DVDs, copying large amounts of data (such as with @Soumya92's suggestion in a Comment [to your Question] to convert videos which would also consume processing power), or even running a scan on your hard drive for bad sectors (which would require reading every sector) are some things that come to mind.

For using a script, you'd probably have to write your own. It could run in an endless loop copying large amounts of files to a RAM disk (that way when the power goes out, you won't have a corrupt disk to deal with since RAM disks don't matter), a partition used for temporary file storage, or a USB memory stick (or external hard drive).

Here's a more complete list of ideas:

  • Write CDs or DVDs
  • Copy large amounts of data
  • Convert videos (@Soumya92's suggestion in a Comment to the original Question)
  • Run a hard drive scan for bad sectors
  • Write a custom script that copies data to temporary storage, repeatedly
  • Turn up sound, brightness, and other features
  • Plug in a USB cellular phone charger (and charge a phone that's powered on)
  • Plug in a USB reading lamp and turn the light on
  • Plug in a USB fan and run it
  • Plug in an iPod (or similar device) and play music or videos at full volume and brightness
  • Download torrents of public domain movies or music (assuming you can find some)
  • Play some online games (especially the 3D kind that require more graphics processing power)
  • Backup your entire hard drive to an external hard drive
  • Install BOINC and run SETI@home (or other BOINC projects): http://setiathome.berkeley.edu/
  • Set up a Virtual PC, install Unix or Linux, and compile FFMPEG, VLC, OpenJDK 7, and TomCat (plus, anything else you'd like to experiment with)
  • Engage in video chat with your friends
  • Encrypt important data using the most complicated and most secure algorithms you can find

Whatever can bog down your system with lots of disk I/O (which also includes CD and DVD activity) and high CPU utilization should do the trick. Additional power drain from USB devices that don't have their own power sources can help too.

Randolf Richardson

Posted 2011-08-21T06:47:55.740

Reputation: 14 002

3

In general, use 100% of CPU usage, turn up the brightness, don't let it go to sleep.

soandos

Posted 2011-08-21T06:47:55.740

Reputation: 22 744

Whilst keeping the CPU busy is easily achieved and will definitely drain battery, keeping the screen on at it's brightest setting as you mentioned will always be the biggest power consumer, +1. – Jack – 2015-09-28T12:29:28.980

0

while [ true ]
do
dd if=/dev/zero of=/junk bs=1024 count=5120000
rm -f /junk
done

this will keep writing 5gb to a file called /junk and then delete it

aspitzer

Posted 2011-08-21T06:47:55.740

Reputation: 154

8Writing data to disk shortens its lifespan, so I would advise against doing this. – suweller – 2012-07-11T15:11:39.133

-1

Do this in terminal:

while [ true ]
do
  dd if=/dev/zero of=/junk bs=1024 count=5120000
  rm -f /junk
done

This should shorten your battery life. Do not try to do this in two tabs, otherwise your computer will shut down and you will have to take it in for service.

Arji Kadsfi

Posted 2011-08-21T06:47:55.740

Reputation: 1

1Can you elaborate ? – bertieb – 2015-09-28T12:35:19.753

Excuse my ignorance - how is it different from looping a same video on a media player.... – Prasanna – 2015-09-28T12:56:50.063