zsh-users
 help / color / mirror / code / Atom feed
* Tracking idletimes
@ 1998-12-15 23:27 Gossamer
  1998-12-15 23:59 ` Phil Pennock
  0 siblings, 1 reply; 8+ messages in thread
From: Gossamer @ 1998-12-15 23:27 UTC (permalink / raw)
  To: zsh-users

Not quite on-topic but I can't think where else to ask!

I want to put together a daemon to track idletime, the sort of thing
that tells you to get up and stretch every half hour of worktime.

Trouble is, there's no way I can figure out to track "Last keypress in
any virtual terminal" (I don't and can't use X) and finger is reporting
invalid idletimes :(.

If I run a shellscript that calls other programs, the idletime for
that VT gets reset every time the secondary program is activated.  It
also seems to like to report Mutt as un-idle even when it is.

Any ideas?


bekj


-- 
: --Hacker-Neophile-Eclectic-Geek-Grrl-Gay-Disabled-Boychick--
: gossamer@tertius.net.au  http://www.tertius.net.au/~gossamer/
: Linux hackers are funny people: They count the time in
: patchlevels.  -- Gerd Knorr


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Tracking idletimes
  1998-12-15 23:27 Tracking idletimes Gossamer
@ 1998-12-15 23:59 ` Phil Pennock
  1998-12-16  5:01   ` Gossamer
  0 siblings, 1 reply; 8+ messages in thread
From: Phil Pennock @ 1998-12-15 23:59 UTC (permalink / raw)
  To: zsh-users

Typing away merrily, Gossamer produced the immortal words:
> I want to put together a daemon to track idletime, the sort of thing
> that tells you to get up and stretch every half hour of worktime.

Make it sleep half an hour at a time then.
while :
do
  sleep $[60*30]
  do_whatever
done

> Trouble is, there's no way I can figure out to track "Last keypress in
> any virtual terminal" (I don't and can't use X) and finger is reporting
> invalid idletimes :(.

Not sure if there is a portable way to do that.  But your stated problem
doesn't require it.  If you want to restrict it to worktime, then wrap
vlock with a shell-function which does, eg:
function lockterm {
  killall -USR1 my_idle_daemon_name
  vlock -a
  killall -USR2 my_idle_daemon_name
}
and then adjust your daemon to handle the signals.

> If I run a shellscript that calls other programs, the idletime for
> that VT gets reset every time the secondary program is activated.  It
> also seems to like to report Mutt as un-idle even when it is.

What are you using to try and get 'idle time'?
-- 
--> Phil Pennock ; GAT d- s+:+ a22 C++(++++) UL++++/I+++/S+++/H+ P++@ L+++
E-@ W(+) N>++ o !K w--- O>+ M V !PS PE Y+ PGP+ t-- 5++ X+ R !tv b++>+++ DI+ D+
G+ e+ h* r y?


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Tracking idletimes
  1998-12-15 23:59 ` Phil Pennock
@ 1998-12-16  5:01   ` Gossamer
  1998-12-16  9:53     ` Bart Schaefer
  1998-12-16 15:42     ` Anthony Whitehouse
  0 siblings, 2 replies; 8+ messages in thread
From: Gossamer @ 1998-12-16  5:01 UTC (permalink / raw)
  To: zsh-users

Phil Pennock (phil@athenaeum.demon.co.uk) wrote...
> Typing away merrily, Gossamer produced the immortal words:
> > I want to put together a daemon to track idletime, the sort of thing
> > that tells you to get up and stretch every half hour of worktime.
> Make it sleep half an hour at a time then.
> while :
> do
>   sleep $[60*30]
>   do_whatever
> done

Doesn't quite solve the problem, it's too simple :-/.

Let me explain it this way:  Because of various things beyond my
control, my workstyle is to sit down at various times during the
day/night and do about half an hour of work.  After that half hour
it's really important I get up and stretch and walk around.  Imagine a
sort of body-wide tendancy to RSI.

What I want the computer to do is somehow "sense" when I'm using it
and tell me to get up and stretch.  Then to "know" when I have -
because if I haven't then it keeps telling me every minute to get up
until I do.  I mean 'tell' literally by the way - I use a voice synth
:).

>> If I run a shellscript that calls other programs, the idletime for
>> that VT gets reset every time the secondary program is activated. 
>> It also seems to like to report Mutt as un-idle even when it is.
> What are you using to try and get 'idle time'?

At the moment it's a perl script that parses the output of 'finger
@localhost' but that just grabs it from /var/wtmp.  I haven't been
bothered to write a module to access wtmp directly.


bekj

-- 
: --Hacker-Neophile-Eclectic-Geek-Grrl-Gay-Disabled-Boychick--
: gossamer@tertius.net.au  http://www.tertius.net.au/~gossamer/
: It is the business of the future to be dangerous.  -- Hawkwind


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Tracking idletimes
  1998-12-16  5:01   ` Gossamer
@ 1998-12-16  9:53     ` Bart Schaefer
  1998-12-16 15:42     ` Anthony Whitehouse
  1 sibling, 0 replies; 8+ messages in thread
From: Bart Schaefer @ 1998-12-16  9:53 UTC (permalink / raw)
  To: gossamer, zsh-users

On Dec 16,  5:01am, Gossamer wrote:
} Subject: Re: Tracking idletimes
}
} What I want the computer to do is somehow "sense" when I'm using it
} and tell me to get up and stretch.

If you're on a linux box (I'm guessing by the reference to virtual
consoles), try using "stat" or "ls -l" on the /dev/tty? device files.
If the mod time is changing, then either you're sitting there typing
or some job is generating continuous output.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Tracking idletimes
  1998-12-16  5:01   ` Gossamer
  1998-12-16  9:53     ` Bart Schaefer
@ 1998-12-16 15:42     ` Anthony Whitehouse
  1998-12-16 23:57       ` Gossamer
  1 sibling, 1 reply; 8+ messages in thread
From: Anthony Whitehouse @ 1998-12-16 15:42 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: message body text --]
[-- Type: text/plain, Size: 371 bytes --]



What I do is have a program running which tells me to get up and
stretch every 60 minutes.  The trick is that it uses an Xdialog box
with an ok button.  The thirty minutes starts after ok is pressed.
When I get in to work or whatever, I press ok, and my 60 minutes
starts over. 

I know you're looking for something more complex, but this is simple,
and works for me.


[-- Attachment #2: xreminder --]
[-- Type: text/plain, Size: 408 bytes --]

#!/bin/perl
$filename = '$HOME/eye_reminder';
$sleeptime = 60*60;		# 60 minutes sleeptime
$bitmap = '$HOME/public_html/eye.xbm';

while(1){
    $pid = fork;
    if($pid == 0){		# if child
	exec("/usr/bin/X11/xdialog -geometry +450+400 -p $bitmap -f $filename -fg red -bg lightgrey")	# start the dialog box
	}
    else {			# if parent
	wait;			# wait for the dialog box to finish
	sleep($sleeptime);	
    }
}

[-- Attachment #3: message body and .signature --]
[-- Type: text/plain, Size: 274 bytes --]



Anthony

-- 
                                   
Anthony P. Whitehouse              
These opinions do not necessarily represent those of my employer
                                   
Mailto:Anthony_Whitehouse@hp.com   
	--or--			   
Mailto:A.Whitehouse@computer.org   

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Tracking idletimes
  1998-12-16 15:42     ` Anthony Whitehouse
@ 1998-12-16 23:57       ` Gossamer
  0 siblings, 0 replies; 8+ messages in thread
From: Gossamer @ 1998-12-16 23:57 UTC (permalink / raw)
  To: zsh-users

Anthony Whitehouse (apw@fc.hp.com) wrote...
> What I do is have a program running which tells me to get up and
> stretch every 60 minutes.  The trick is that it uses an Xdialog box
> with an ok button.  The thirty minutes starts after ok is pressed.
> When I get in to work or whatever, I press ok, and my 60 minutes
> starts over. 
> I know you're looking for something more complex, but this is simple,
> and works for me.

As I pointed out in the original post, I don't and can't use X.


bekj

-- 
: --Hacker-Neophile-Eclectic-Geek-Grrl-Queer-Disabled-Boychick--
: gossamer@tertius.net.au   http://www.tertius.net.au/~gossamer/
: On-line, adj.: The idea that a human being should always be
: accessible to a computer.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Tracking idletimes
  1998-12-16 18:26 Juergen Sell
@ 1998-12-16 23:56 ` Gossamer
  0 siblings, 0 replies; 8+ messages in thread
From: Gossamer @ 1998-12-16 23:56 UTC (permalink / raw)
  To: zsh-users

Juergen Sell (js@euler.han.de) wrote...
> why not have preexec touch a file and have a cron job looking at its
> timestamp?  This would be based on you using your shell - maybe not
> a very bad guess considering you do not use X.

I don't quite follow you, 'preexec'?  I think I'm missing some info
here!


bekj

-- 
: --Hacker-Neophile-Eclectic-Geek-Grrl-Queer-Disabled-Boychick--
: gossamer@tertius.net.au   http://www.tertius.net.au/~gossamer/
: On-line, adj.: The idea that a human being should always be
: accessible to a computer.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Tracking idletimes
@ 1998-12-16 18:26 Juergen Sell
  1998-12-16 23:56 ` Gossamer
  0 siblings, 1 reply; 8+ messages in thread
From: Juergen Sell @ 1998-12-16 18:26 UTC (permalink / raw)
  To: zsh-users

Hi,
why not have preexec touch a file and have a cron job looking at its timestamp?
This would be based on you using your shell - maybe not a very bad guess  
considering you do not use X.
HTH, Juergen


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~1998-12-17  0:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-12-15 23:27 Tracking idletimes Gossamer
1998-12-15 23:59 ` Phil Pennock
1998-12-16  5:01   ` Gossamer
1998-12-16  9:53     ` Bart Schaefer
1998-12-16 15:42     ` Anthony Whitehouse
1998-12-16 23:57       ` Gossamer
1998-12-16 18:26 Juergen Sell
1998-12-16 23:56 ` Gossamer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).