Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Fri 25 Jul 2014, 13:45
All times are UTC - 4
 Forum index » House Training » Users ( For the regulars )
How to set timer to turn off laptop?
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 2 [18 Posts]   Goto page: 1, 2 Next
Author Message
liatodua

Joined: 25 Aug 2011
Posts: 22

PostPosted: 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
View user's profile Send private message 
L18L

Joined: 19 Jun 2010
Posts: 2504
Location: Burghaslach, Germany somewhere also known as "Hosla"

PostPosted: 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
View user's profile Send private message 
JSonic


Joined: 21 Aug 2011
Posts: 37
Location: Finland

PostPosted: 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
View user's profile Send private message 
liatodua

Joined: 25 Aug 2011
Posts: 22

PostPosted: 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
View user's profile Send private message 
aarf

Joined: 30 Aug 2007
Posts: 3620
Location: around the bend

PostPosted: 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
View user's profile Send private message Visit poster's website 
aarf

Joined: 30 Aug 2007
Posts: 3620
Location: around the bend

PostPosted: 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
View user's profile Send private message Visit poster's website 
liatodua

Joined: 25 Aug 2011
Posts: 22

PostPosted: Mon 12 Sep 2011, 12:37    Post subject:  

Thanks. Installed pwidgets. Looking now for the script to modify
Back to top
View user's profile Send private message 
liatodua

Joined: 25 Aug 2011
Posts: 22

PostPosted: 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
View user's profile Send private message 
ahoppin

Joined: 16 May 2011
Posts: 87

PostPosted: 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
View user's profile Send private message 
pemasu


Joined: 08 Jul 2009
Posts: 5463
Location: Finland

PostPosted: 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.
laptop-acpi-battery-tools-0.0.1.pet
Description 
pet

 Download 
Filename  laptop-acpi-battery-tools-0.0.1.pet 
Filesize  161.21 KB 
Downloaded  639 Time(s) 

Last edited by pemasu on Mon 12 Sep 2011, 14:58; edited 2 times in total
Back to top
View user's profile Send private message 
liatodua

Joined: 25 Aug 2011
Posts: 22

PostPosted: Mon 12 Sep 2011, 14:43    Post subject:  

Thanks a lot! I'll try it.
Back to top
View user's profile Send private message 
liatodua

Joined: 25 Aug 2011
Posts: 22

PostPosted: 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
View user's profile Send private message 
aarf

Joined: 30 Aug 2007
Posts: 3620
Location: around the bend

PostPosted: Tue 13 Sep 2011, 05:43    Post subject:  

note that
Code:
-lt 7
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
Code:
-lt 1
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
View user's profile Send private message Visit poster's website 
playdayz


Joined: 25 Apr 2008
Posts: 3788

PostPosted: 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
View user's profile Send private message 
pemasu


Joined: 08 Jul 2009
Posts: 5463
Location: Finland

PostPosted: 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
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 2 [18 Posts]   Goto page: 1, 2 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » Users ( For the regulars )
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0796s ][ Queries: 13 (0.0057s) ][ GZIP on ]