| Author |
Message |
liatodua
Joined: 25 Aug 2011 Posts: 22
|
Posted: Sun 11 Sep 2011, 06:35 Post subject:
How to set timer to turn off laptop? |
|
Is it possible in puppy to set poweroff of computer in say 30 minutes when laptop works on batteries? Can not find relevant menu.
Thanks in advance
|
|
Back to top
|
|
 |
L18L
Joined: 19 Jun 2010 Posts: 1715 Location: Burghaslach, Germany
|
Posted: Sun 11 Sep 2011, 10:04 Post subject:
|
|
you might try this
http://www.murga-linux.com/puppy/viewtopic.php?t=69275
|
|
Back to top
|
|
 |
JSonic

Joined: 21 Aug 2011 Posts: 37 Location: Finland
|
Posted: Sun 11 Sep 2011, 10:23 Post subject:
|
|
Or, if you don't want to install any additional software, you can type in terminal (Roxterm, urxvt...)
| Code: | | sleep 30m && wmpoweroff & |
But if you run this, terminal must be left open.
|
|
Back to top
|
|
 |
liatodua
Joined: 25 Aug 2011 Posts: 22
|
Posted: Sun 11 Sep 2011, 10:47 Post subject:
|
|
I guess I should have explained better:
I am setting up an old nettbook for my grandsun (2,5 years old). He usually forgets to shut down the computer (although I put big shutdown icon on desktop). So the netbook is all time switched on, but sometimes power goes off and the battery can only work for 30 minutes. After that the netbook has sudden blackout. And every time this happens puppy crashes.
Usually other distors have some power management tools where you can request that if laptop works on batteries in some minutes it automatically shuts down. I hoped that if I set up that in that case puppy would not crash.
Is it possible to make the sleep or poweroff commands dependant on whether the laptop works on AC or the batteries? Or is there any other way to prevent puppy from crashing at sudden blackout?
|
|
Back to top
|
|
 |
aarf
Joined: 30 Aug 2007 Posts: 3620 Location: around the bend
|
Posted: Sun 11 Sep 2011, 11:48 Post subject:
|
|
Pwidgets has an app that monitors the battery. It pops up warnings at pre-set battery levels. Perhaps modify the script to poweroff when battery level of say zero is detected. Timer wouldn't be necessary but you could add one if you want.
_________________
ASUS EeePC Flare series 1025C 4x Intel Atom N2800 @ 1.86GHz RAM 2063MB 800x600p ATA 320G
_-¤-_
<º))))><.¸¸.•´¯`•.#.•´¯`•.¸¸. ><((((º>
|
|
Back to top
|
|
 |
aarf
Joined: 30 Aug 2007 Posts: 3620 Location: around the bend
|
Posted: Sun 11 Sep 2011, 11:57 Post subject:
|
|
Choose ext3 for your pupsave and put pfix=fsck into your grub boot kernel line.
_________________
ASUS EeePC Flare series 1025C 4x Intel Atom N2800 @ 1.86GHz RAM 2063MB 800x600p ATA 320G
_-¤-_
<º))))><.¸¸.•´¯`•.#.•´¯`•.¸¸. ><((((º>
|
|
Back to top
|
|
 |
liatodua
Joined: 25 Aug 2011 Posts: 22
|
Posted: Mon 12 Sep 2011, 12:37 Post subject:
|
|
Thanks. Installed pwidgets. Looking now for the script to modify
|
|
Back to top
|
|
 |
liatodua
Joined: 25 Aug 2011 Posts: 22
|
Posted: Mon 12 Sep 2011, 12:50 Post subject:
|
|
Found script of the Battery gauge.. It says:
#! /bin/sh
if [ -d /sys/class/power_supply/BAT0 ]; then BAT='BAT0'; fi
if [ -d /sys/class/power_supply/BAT1 ]; then BAT='BAT1'; fi
if [ -d /sys/class/power_supply/BAT2 ]; then BAT='BAT2'; fi
STATUS="`cat /sys/class/power_supply/$BAT/status`"
CHARGE_FULL="`cat /sys/class/power_supply/$BAT/charge_full`"
CHARGE_NOW="`cat /sys/class/power_supply/$BAT/charge_now`"
CHARGE_PERCENT=$[$CHARGE_NOW*100/$CHARGE_FULL]
if [ $CHARGE_PERCENT -lt 7 ]; then
echo 1
STATUS="`cat /sys/class/power_supply/$BAT/status`"
TMP="`ps`"
if [ $CHARGE_PERCENT -lt 7 ] && [ $STATUS != Charging ] && [ ! "`echo "$TMP" | grep 'WARNING: Battery'`" ]; then
yaf-splash -text "WARNING: Battery are running low!" -margin 2 -bg red -bw 0 -placement top -font "9x15B" -outline 0 &
fi
fi
#find char
TMP="abcdefghijklmnopqrstu"
[[ "$CHARGE_PERCENT" -eq 0 ]] && echo a || echo ${TMP:$(( $CHARGE_PERCENT/5 )):1}
Could you tell me where should I add poweroff?
|
|
Back to top
|
|
 |
ahoppin
Joined: 16 May 2011 Posts: 73
|
Posted: Mon 12 Sep 2011, 14:03 Post subject:
|
|
You could replace the line that says
yaf-splash -text "WARNING: Battery are running low!" -margin 2 -bg red -bw 0 -placement top -font "9x15B" -outline 0 &
With the poweroff command.
(And shouldn't that be "Battery IS running low"?) Ah, well.
|
|
Back to top
|
|
 |
pemasu

Joined: 08 Jul 2009 Posts: 5169 Location: Finland
|
Posted: Mon 12 Sep 2011, 14:31 Post subject:
|
|
Here is the modified version of my laptop-tools. It consists of acpitool, vattery,vattery-ibam-vattery-acpitool,xbindkeys,acpid, ppower, cpu-frequency tray app needed framework, extra Fn + function buttons support like media buttons. You need to use xbindkeys-config to bind the buttons to executables found on your comp or laptop.
What it provides. It provides Vattery-ibam and Vattery-acpitool with needed framework to handle verbose warnings and also executable commands at certain battery state levels.
Check /root/.config/vattery-ibam/config and corresponding vattery-acpitool/config text files how to configure the commands for your needs.
For me...I get verbose warning at battery state level 10 % and suspending to the ram at battery level 5 %.
I have included those config files in the pet.
Also you get those other functionality for laptop or netbook. Like power button should shut down the comp. Laptop or netbook sleep button suspends to the ram, lid closing suspends to the ram.
If something is missing, report. I removed Frisbee and dhcpcd stuff from the pet so I hope I didnt remove anything needed.
Vattery-ibam is sometimes picky. If you dont get new battery icon to the tray after reboot, restart X is not enough to get whole functionality, edit /root/Startup/1vattery script and leave only shebang row and exec vattery-acpitool row. Save and restart X.
 |
| Description |
|

Download |
| Filename |
laptop-acpi-battery-tools-0.0.1.pet |
| Filesize |
161.21 KB |
| Downloaded |
437 Time(s) |
Last edited by pemasu on Mon 12 Sep 2011, 14:58; edited 2 times in total
|
|
Back to top
|
|
 |
liatodua
Joined: 25 Aug 2011 Posts: 22
|
Posted: Mon 12 Sep 2011, 14:43 Post subject:
|
|
Thanks a lot! I'll try it.
|
|
Back to top
|
|
 |
liatodua
Joined: 25 Aug 2011 Posts: 22
|
Posted: Mon 12 Sep 2011, 22:34 Post subject:
|
|
Probem solved: I Installed pwidgets and changed csript of Battery (at /usr/local/pwidgets/widgets/scripts/Battery
Namely, replaced the text
yaf-splash -text "WARNING: Battery are running low!" -margin 2 -bg red -bw 0 -placement top -font "9x15B" -outline 0 &
with
wmpoweroff
With active pwidget Battery it safely shuts down the computer at critical battery.
Thanks!
And thanks to pemasu - His tool allows shutdown through simply pushing the power button. Very useful! And yes, finally - wireless connection established on Asus eee pc! (which was hopeless from any puppe except from pupeee). Thaanks!!!
|
|
Back to top
|
|
 |
aarf
Joined: 30 Aug 2007 Posts: 3620 Location: around the bend
|
Posted: Tue 13 Sep 2011, 05:43 Post subject:
|
|
note that means less than 7%.
depending on the characteristics of your battery you may find something else more suitable. my battery runs at 1% for a long time then at 0% for quite a while.
it also goes under 7% quite quickly. so for me would be more convenient. your battery and needs will very likely differ.
_________________
ASUS EeePC Flare series 1025C 4x Intel Atom N2800 @ 1.86GHz RAM 2063MB 800x600p ATA 320G
_-¤-_
<º))))><.¸¸.•´¯`•.#.•´¯`•.¸¸. ><((((º>
|
|
Back to top
|
|
 |
playdayz

Joined: 25 Apr 2008 Posts: 3705
|
Posted: Sun 11 Mar 2012, 12:27 Post subject:
|
|
Hi pemasu, I have a dumb question: Is this complete, or does it require some other components of acpi (or anything else) to be already installed? Thank you.
|
|
Back to top
|
|
 |
pemasu

Joined: 08 Jul 2009 Posts: 5169 Location: Finland
|
Posted: Sun 11 Mar 2012, 13:34 Post subject:
|
|
This provides all stuff. It has stuff for keybindings through xbindkeys-config, acpid demon for acpi, acpitool for suspending in ram, battery monitoring, verbose warning and possibilty to suspend at configured battery percent level or shutdown....the vattery-acpitool and vattery-ibam accepts whatever command. Also there is tray cpu frequency setting tray app and so on...
This pet provides the whole set for Lucid Puppy. I use this stuff in my Lucid builds.
Of course there might be something which needs tuning. I dont remember so accurately if I finetuned the scripts after I posted this pet.
Answer...you get Vattery tray app for verbose warnings and possiblity to execute commands, keybindings for laptop function buttons...might need reconfiguring for Lucid Puppy apps...power button shuts down...Fn + Zz button suspends to ram..ppower tray app gives tray cpu frequency scaling tray app.
It consists of all the needed binaries, /root/Startup scripts and the whole framework of scripts in /etc/acpi/*
|
|
Back to top
|
|
 |
|