Start a new topic

run command or key sequence frequently in SSH

first of all , BIG BIG thank you for your grate effort

I'd like to ask for an option to be able to run a command or key sequence frequently in SSH session

I mean if I have an opened ssh session and i want to run command or key sequence every like 3 minuets 


Hi!


I'm not sure Royal TS is the right place for something like this or maybe I'm not seeing the use case. Can you provide some samples and describe in more details what you are trying to achieve? Also, are there other clients with similar features we can look at on how this should be set up?


Key sequence tasks to be invoked periodically is quite dangerous and can lead to unpredictable behavior because the task could never know what state the terminal is currently in.


Same is for sending commands periodically. Why not simply do something like this?

https://askubuntu.com/questions/430382/repeat-a-command-every-x-interval-of-time-in-terminal

or this

https://stackoverflow.com/questions/17394356/how-can-i-make-a-bash-command-run-periodically


Seems to be much safer.


Regards,
Stefan

thanks for your answer 

in many platforms , it's not that easy to apply a command like examples you sent 

for example , in ATCA MSC or KAIROS HLR , sometimes we need to monitor the device performance by applying a command that give us only one result 

for example , this is a famous command in Linux to monitor the desk usage ( df -h )

this give you the actual  free space , But what if I want to monitor the free space for 10 hours ? 

So we have to manually run the command for 10 hours 

The Idea here that you already implemented ( Auto refresh ) in the web GUI , So we need to run a command frequently  ( Like Auto refresh ) in SSH

hope you got my point 

Best regards  

I see. Can you point to other terminals/tools which have a similar feature?

it's exist in many compotator s.w under ( Macro ) tab , like MobaXterm


image


and I think it's really worth for everyone to implement it in Royal TS , specially it's easy to be implemented in SSH , you need just to add a button to re-run a command in a certain period of time , that's it

I'm not familiar with this tool. Can you provide more screenshots how this is setup and maybe also some more information how this is supposed to work? For example, are commands periodically sent to the remote session interactively using full qualified paths or "hidden" (in background)? What happens with the output? Is it displayed in the terminal or is the terminal not usable in this "mode"? Doesn't it interfere with normal interactive usage?

Hi Stefan 

the situation is much easy than you think 

What I'm asking for , is Similar to add this in Key Sequence

{WAIT:60000}df -h

{WAIT:60000}df -h

{WAIT:60000}df -h

{WAIT:60000}df -h

{WAIT:60000}df -h

..

..

..


and run this Key sequence , So it's So easy to implement it 


Not sure what you mean by "m not familiar with this tool " do you refer to the Macro or MobaXterm ?

--> the Macro is well know and exist everywhere even in Microsoft office since 10 year ago

--> MobaXterm  is the Biggest and Only competitor to Royal T.S , 

 So I wounder what exactly you are not familiar with ?

to answer your question 

*  commands periodically sent to the remote session interactively using full qualified paths or "hidden" (in background) ?

Answer : Not in background , normally the user need to see the result 

* what happens with the output ?

Answer : Noting , it's shown in the screen in the SSH session , Similer like I applied it myself 

*Is it displayed in the terminal or is the terminal not usable in this "mode"?

Answer : Yes , for sure it's displayed in the terminal ,

* Doesn't it interfere with normal interactive usage?

Answer : Normally when the user use such option , he wait for the result in the same session , So it has nothing with the interactive usage


Hope this answer your question 

Hi Stefan 

The situation is much easier that you think .. What I'm asking for , is Similar to create Key sequence like this

 {WAIT:60000}df -h

{WAIT:60000}df -h

{WAIT:60000}df -h

{WAIT:60000}df -h

......

.....

...

...

and run it in a session , That's Typically what i'm looking for


Moreover , I don't understand what you mean by " 'm not familiar with this tool " ? Do you refer to the Macro or MobaXterm

--> The Macro is exist everywhere even in Microsoft Word since 10 year ago

--> MobaXterm is the Biggest and Only competitor to Royal TS 

So I'm not really sure what you mean

to answer your question One by one

** commands periodically sent to the remote session interactively using full qualified paths or "hidden" (in background)

Answer : Not hidden for sure , Normally we use such feature to see the result ( the return massage ) 


** What happens with the output? Is it displayed in the terminal or is the terminal not usable in this "mode"?

Answer : Yes sure it's displayed in the terminal 


** Doesn't it interfere with normal interactive usage?

it has nothing with the , Normally when we use such option ( Ex : for 1 hour ) we just look to the screen and record the session logs ,So no one touch the session till it finish 


Hope this answer you question

I think I know what you are looking for. What I'm trying to figure out are the details of the implementation.


The main issue I see is that after you open an interactive terminal, the "scheduled/repeating" key sequences can interfere with the terminal when used interactively. This can be very dangerous. Here's a sample: Let's say for whatever reason, you mistakenly focus one of these sessions and mistakenly type a couple of characters. Shortly afterward, the sequence kicks in and types the configured sequence and submits the "combined" command to the server. The combined command can be destructive and you just shot your own foot.


Let me repeat my initial question as I'm not familiar with the feature set of MobaXterm. I can see they have a Makro feature (similar to our key sequence task) but what I'm interested in is how you can setup it to repeat and how this affects the interactive terminal. How do they do it in a "safe" way. Or name any other terminal tool with such a feature. I couldn't find one as for the most part, this should be handled "within" the terminal IMHO as mentioned in my first response and not from the client as it's to dangerous.

Login or Signup to post a comment