Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: zsh portable script
- X-seq: zsh-users 15185
- From: Atom Smasher <atom@xxxxxxxxxxx>
- To: "Benjamin R. Haskell" <zsh@xxxxxxxxxx>
- Subject: Re: zsh portable script
- Date: Wed, 14 Jul 2010 03:28:25 +1200 (NZST)
- Cc: zsh-users@xxxxxxx
- In-reply-to: <alpine.LNX.2.01.1007130942440.4808@xxxxxxxxxxx>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- Openpgp: id=0xB88D52E4D9F57808; algo=1 (RSA); size=4096; url=http://atom.smasher.org/pgp.txt
- References: <1007130241570.5546@smasher> <201007121737.21296.joke@xxxxxxxxx> <201007121745.20332.joke@xxxxxxxxx> <20100712161519.GO1499@xxxxxxxxxxxxxxxxxxx> <1007140055140.5546@smasher> <alpine.LNX.2.01.1007130942440.4808@xxxxxxxxxxx>
On Tue, 13 Jul 2010, Benjamin R. Haskell wrote:
But, I don't recall ever needing root to read the battery status. (In
the /proc/acpi subsystem that you're using,
/proc/acpi/battery/BAT{0,1}/{info,state} are chmod 0444 on my laptop and
netbook; same for the /sys/class/ stuff I used above.) And on my
FreeBSD webhost where I have pretty resticted access, I seem to be able
to grab a lot of hardware-related info via sysctl.
==============
from what i've seen, linux permissions to anything in /proc depend on the
distro, but the same *info* is available to anyone with local access on a
bsd box via sysctl.
i'm more familiar with freebsd than linux. are you saying that
/sys/class/power_supply/BAT0/charge_* will be readable when
/proc/acpi/battery/BAT0/* isn't? if that's the case, i'll update the
script.
Are permissions the reason you suggest running it under cron? Otherwise,
why not just regenerate in precmd()?
==================
on my bsd laptop i always have at least one mrxvt with ten shells open. it
seems to make sense to just have root get the info once per minute and let
the shells read it from a file, than have a bunch of shells all invoking
sysctl and all figuring out about the battery.
i suppose it can be done without privileges, and it shouldn't burden the
machine; then i suppose it might make sense to get rid of the battery
script and put the logic into precmd. i suppose the worst case is a
hundred or so shells all working it out for themselves... that shouldn't
cause any problems... except if the machine is bogged down and it takes
that much longer to wait for a prompt that's hung while something it needs
to generate a battery notice is blocked (although that risk is probably
there already with the load monitor). i might be able to add a short
timeout, in which case it will just skip it... something to think about, i
guess.
--
...atom
________________________
http://atom.smasher.org/
762A 3B98 A3C3 96C9 C6B7 582A B88D 52E4 D9F5 7808
-------------------------------------------------
Quidquid latine dictum sit, altum viditur.
(Whatever is said in Latin sounds profound.)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author