commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
Fully recharge your computer battery and start this script.
It will create or clean the file named battery.txt, print a start on it and every minute it will append a time stamp to it.
Batteries last few hours, and each hour will have 60 lines of time stamping. Really good for assuring the system was tested in real life with no surprises.
The last time stamp inside the battery.txt file is of interest. It is the time the computer went off, as the battery was dead!
Turn on your computer after that, on AC power of course, and open battery.txt. Read the first and last time stamps and now you really know if you can trust your computer sensors.
If you want a simple line of text inside the battery.txt file, use this:
watch -n 60 'date > battery.txt'
The time of death will be printed inside
There is 1 alternative - vote for the best!
If you can do better, submit your command here.
You must be signed in to comment.