Sponsored Content
Operating Systems BSD Battery Empty -> force shutdown Post 302341790 by ccc on Thursday 6th of August 2009 03:05:15 PM
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

 

6 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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
SYSTEMD-RC-LOCAL-GENERATOR(8)				    systemd-rc-local-generator				     SYSTEMD-RC-LOCAL-GENERATOR(8)

NAME
systemd-rc-local-generator - Compatibility generator for starting /etc/rc.local and /usr/sbin/halt.local during boot and shutdown SYNOPSIS
/lib/systemd/system-generators/systemd-rc-local-generator DESCRIPTION
systemd-rc-local-generator is a generator that checks whether /etc/rc.local exists and is executable, and if it is pulls the rc-local.service unit into the boot process. This unit is responsible for running this script during late boot. Note that the script will be run with slightly different semantics than the original System V version, which was run "last" in the boot process, which is a concept that does not translate to systemd. The script is run after network.target, but in parallel with most other regular system services. systemd-rc-local-generator also checks whether /usr/sbin/halt.local exists and is executable, and if it is pulls the halt-local.service unit into the shutdown process. This unit is responsible for running this script during later shutdown. Support for both /etc/rc.local and /usr/sbin/halt.local is provided for compatibility with specific System V systems only. However, it is strongly recommended to avoid making use of these scripts today, and instead provide proper unit files with appropriate dependencies for any scripts to run during the boot or shutdown processes. systemd-rc-local-generator implements systemd.generator(7). SEE ALSO
systemd(1), systemctl(1) systemd 237 SYSTEMD-RC-LOCAL-GENERATOR(8)
All times are GMT -4. The time now is 08:20 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy