Battery Empty -> force shutdown


 
Thread Tools Search this Thread
Operating Systems BSD Battery Empty -> force shutdown
# 1  
Old 08-01-2009
Battery Empty -> force shutdown

hi

Howto force shutdown on the notebook with freeBSD before battery is empty?
# 2  
Old 08-01-2009
Try 'shutdown now' or '/sbin/init 0'
# 3  
Old 08-01-2009
Quote:
Originally Posted by nitin
Try 'shutdown now' or '/sbin/init 0'
I mean to shutdown automaticaly from script, cron etc.

Last edited by ccc; 08-04-2009 at 11:07 AM..
# 4  
Old 08-06-2009
Code:
#!/bin/csh
# /usr/local/sbin/batterytest
# Baterry control
 
set restminutes=`/sbin/sysctl -n hw.acpi.battery.time`
set modus=`/sbin/sysctl -n hw.acpi.battery.state`
 
# does it have Power Supply connected?
if ( "${modus}" == "1" ) then
 
  # 7 Minutes?
  if ( "${restminutes}" < "7" ) then
    shutdown -p +2 "The Battery is empty! The Computer will shutdown after 2 Minutes!" &
  endif

endif

Code:
# chown root /usr/local/sbin/batterytest
# chmod u+x /usr/local/sbin/batterytest

add to crontab:
Code:
*/5 * * * * /usr/local/sbin/batterytest

Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. AIX

TOD battery dead

My TOD battery of IBM 285 is dead Fast question: i have to buy an original battery(there is only one on ebay!) Or i can use a normal lithium battery for pc bios? Thanks (2 Replies)
Discussion started by: Linusolaradm1
2 Replies

2. Programming

c/c++ clock like , battery charging

Hi all , I need to make a program who describes this ( upper ) graphic: http://upload.wikimedia.org/wikipedia/commons/8/82/Sawtooth-td_and_fd.png My idea is to implement a battery charge x: 0 to time T, y : 0 to 1 values. Can you help me ? (1 Reply)
Discussion started by: jerold
1 Replies

3. UNIX for Dummies Questions & Answers

Script to force Oracle database shutdown when shutdown immediate does not work

I have Oracle 9i R2 on AIX 5.2. My Database is running in shared server mode (MTS). Sometimes when I shutdown the database it shutsdown cleanly in 4-5 mints and sometimes it takes good 15-20 minutes and then I get some ora-600 errors and only way to shutdown is by opening another session and... (7 Replies)
Discussion started by: aixhp
7 Replies

4. Linux

Battery always 0%

Im running Ubuntu 9.04 and the battery indicator on my laptop always reads 0% no matter what. Whether im charging or discharging, the pop up says: "Computer is running on battery power Laptop battery discharging (0.0%) Battery discharge time is currently unknown" When plugged in it says... (2 Replies)
Discussion started by: Charbs
2 Replies

5. UNIX for Dummies Questions & Answers

Getting same exit status for empty and non empty file

Hi All, I am checking for a empty input file to do some further action , but I am getting exit status 0 in both the cases , for empty and non empty file both. The value of $? is coming 0 in if part also and else part too. #!/bin/ksh if ]; then echo "data" # exit 0 echo "$?" else... (4 Replies)
Discussion started by: mavesum
4 Replies

6. UNIX for Dummies Questions & Answers

A1000 Battery Question

After searching and finding the link to the A1000 pdf ( http://192.18.99.138/805-7147/805-7147.pdf ) my questions are: 1) I have a battery failure on a A1000. I know that caching is disabled and it reports to see log. After reading the manual I have learned that the battery is a data-cache... (2 Replies)
Discussion started by: finster
2 Replies
Login or Register to Ask a Question