Simulate keystroke

Hi

We have UNIX, Solaris 2.5, ordinary lock screen software
and a service department who always re-boot our machines
at the night. This re-boot does not occur if a user is
working during the night.
I want to simulate an user activity on the
machine ( a check with rusers -l could not tell the
difference ).

This simulation must work even when the lock screen function
is activated.

Is there a way? For example, putting the "shift key"
into the "real" keyboard buffer to simulate keystrokes?



Regards
qcordAsked:
Who is Participating?
 
goodcConnect With a Mentor Commented:
Maybe they are just running a scrpt or program that examines
the modify time of the tty device.

Try this script :

#!/bin/sh

cursor_up=`tput cuu1`

while :
do
        echo "$cursor_up" > `tty`
        sleep 60
done          
0
 
ahoffmannCommented:
hmm, this will be hard 'cause you have to simulate an interrupt.

Never tested this, but try:

    echo -n ' ' >/dev/your_kbd_device
0
 
qcordAuthor Commented:

Well, the only device I had under /dev was /dev/kdb, I tried this
program

#!/bin/ksh

while [ "hello" != "there" ] ; do
   echo -n >/dev/kdb
   sleep
done



but it did not work so I reopen the question

Regards


0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
ahoffmannCommented:
you need to echo at least on char (see my comment ;-)
0
 
qcordAuthor Commented:

I checked the man pages of echo, according to them only
csh and /usr/ucb/echo does have the -n flag so I changed the
progam into

#!/bin/ksh

while [ "hello" != "there" ] ; do
   /usr/ucb/echo -n ' ' >/dev/kdb
   sleep 10
done


But it still does not give the desired effect.
( which is to simulate an active user ).

Regards


0
 
ozoCommented:
How about an expect script to rlogin localhost?
0
 
qcordAuthor Commented:

I do not understand what You mean. do you mean that a
crontab controlled script should do a rlogin on my machine ?

One other way could be to affect the mouse.
My hypothes is that they use the 'rusers -l' to see if the user
is activ or not and mouse "events" will reset the idle time.

0
 
qcordAuthor Commented:
Well I found the solution by myself, after the screen lock is
on I just need to place a glass on the space button during
the night, this will reset the rusers time out.

Regards
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.