Linux Help
guides forums blogs
Home Desktops Distributions ISO Images Logos Newbies Reviews Software Support & Resources Linuxhelp Wiki

Welcome Guest ( Log In | Register )



Advanced DNS Management
New ZoneEdit. New Managment.

FREE DNS Is Back

Sign Up Now
 
Reply to this topicStart new topic
> Passing Key Commands Via Bash?
Jim
post Nov 30 2005, 04:22 PM
Post #1


Its GNU/Linuxhelp.net
*******

Group: Support Specialist
Posts: 1,280
Joined: 19-November 03
From: University of Minnesota- TC
Member No.: 1,828



I don't know if this is possible, but hey, its worth asking.

I am trying to automate a process using bash so I can cron it right. I am using lynx to log into an authentication server and using the -cmd_script= option provide by lynx. Trouble is, I need to wait 120 seconds, then reload in order for the log in to work, and lynx's script has no way (that i know of) to suppor this, so is there any way I can do this via bash?

Thanks.


--------------------
--Jim Lester
jim@linuxhelp.net

Distro: Gentoo
System: AMD Athlon 3000+ XP 2.166 GHz
NVIDIA nForce2 IGP Chipset
1GB 333 MHz DDR SDRAM
NVIDIA nForce2 Dual Head 64 MB Graphics

Server Distro: CentOS
Go to the top of the page
 
+Quote Post
michaelk
post Nov 30 2005, 08:02 PM
Post #2


Its GNU/Linuxhelp.net
*******

Group: Support Specialist
Posts: 1,800
Joined: 23-January 03
Member No.: 360



Use the sleep command.
http://linux.about.com/library/cmd/blcmdl1_sleep.htm
Go to the top of the page
 
+Quote Post
Jim
post Nov 30 2005, 09:44 PM
Post #3


Its GNU/Linuxhelp.net
*******

Group: Support Specialist
Posts: 1,280
Joined: 19-November 03
From: University of Minnesota- TC
Member No.: 1,828



Ya the sleep command gets me the pause, but how do I get the key command to lynx? The lynx script is seperate from the bash script and it just contains the key commands I want to run. Basically I need this. I need lynx to start up, go through its script file, then about 120 seconds later I need to pass it "ctrl+R" so it will reload and finish. The sleep command will get me the pause, but how do I get the command passed to lynx?

Pluse if I haves a script like

lynx --cmd_script=scriptfile
sleep
'pass keys'

It wont go to sleep until lynx is finished, which it can't do, till I pass it the reload... you see the problem?


--------------------
--Jim Lester
jim@linuxhelp.net

Distro: Gentoo
System: AMD Athlon 3000+ XP 2.166 GHz
NVIDIA nForce2 IGP Chipset
1GB 333 MHz DDR SDRAM
NVIDIA nForce2 Dual Head 64 MB Graphics

Server Distro: CentOS
Go to the top of the page
 
+Quote Post
michaelk
post Dec 1 2005, 02:58 PM
Post #4


Its GNU/Linuxhelp.net
*******

Group: Support Specialist
Posts: 1,800
Joined: 23-January 03
Member No.: 360



I believe you can execute local commands from the scriptfile. So in theory you could sleep and then reload.
Go to the top of the page
 
+Quote Post
Jim
post Dec 1 2005, 06:29 PM
Post #5


Its GNU/Linuxhelp.net
*******

Group: Support Specialist
Posts: 1,280
Joined: 19-November 03
From: University of Minnesota- TC
Member No.: 1,828



Even if I could set that up, I don't know how to pass "ctrl+R" to an already running copy of lynx.


--------------------
--Jim Lester
jim@linuxhelp.net

Distro: Gentoo
System: AMD Athlon 3000+ XP 2.166 GHz
NVIDIA nForce2 IGP Chipset
1GB 333 MHz DDR SDRAM
NVIDIA nForce2 Dual Head 64 MB Graphics

Server Distro: CentOS
Go to the top of the page
 
+Quote Post
michaelk
post Dec 1 2005, 07:51 PM
Post #6


Its GNU/Linuxhelp.net
*******

Group: Support Specialist
Posts: 1,800
Joined: 23-January 03
Member No.: 360



A search didn't return any useful information on special key other then down arrow from the documentation. From what I gathered you can log a session and it will save keystrokes. Just guessing this log will contain key strokes and all you need to do is copy them to your file.
Go to the top of the page
 
+Quote Post
Jim
post Dec 2 2005, 02:04 AM
Post #7


Its GNU/Linuxhelp.net
*******

Group: Support Specialist
Posts: 1,280
Joined: 19-November 03
From: University of Minnesota- TC
Member No.: 1,828



I already have the key log for lynx, that isn't the problem. The problem is that they key entry for ctrl+R thats in the log runs as soon as it can, I need it to wait 120 seconds. Its this stupid script. What ever, I appreciate the help, but I don't think it can be done.


--------------------
--Jim Lester
jim@linuxhelp.net

Distro: Gentoo
System: AMD Athlon 3000+ XP 2.166 GHz
NVIDIA nForce2 IGP Chipset
1GB 333 MHz DDR SDRAM
NVIDIA nForce2 Dual Head 64 MB Graphics

Server Distro: CentOS
Go to the top of the page
 
+Quote Post
DS2K3
post Dec 2 2005, 06:22 PM
Post #8


Its GNU/Linuxhelp.net
*******

Group: Support Specialist
Posts: 1,284
Joined: 14-November 04
From: Southampton, Hampshire
Member No.: 4,165



You want to pipe stuff to the stdin of lynx? If you have the PHP CLI installed, then you could use the process andling functions to do it. I daresay Perl/Python etc. could do it too.

D


--------------------
Fixed your problem? Let us know!
richard@linuxhelp.net

www.Gathr.co.uk Online Event Management
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 16th December 2017 - 12:33 AM