LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   General (https://www.linuxquestions.org/questions/general-10/)
-   -   help with the automatic execution of a linux command to form a batch file (https://www.linuxquestions.org/questions/general-10/help-with-the-automatic-execution-of-a-linux-command-to-form-a-batch-file-4175647939/)

jraju 02-09-2019 06:18 AM

help with the automatic execution of a linux command to form a batch file
 
hi, i am anwbie to programming and a fresh newbie to linux forum. I could log in to my router using putty to my router using plink of putty software. i just click it , and i culd log on to $ prompt.
What i want is i want to execute a "show status"inner command toget the important parameters of my router.
plink x.x.x.x user name password gets up to the $ prompt.
how to execute show status command to get the details i want.
going to cmd and issuing this command i could get the detaili want to add a bat file to execute and add to my task bar scheduler available in windows 7.
bin bash are terms that i could not use in my windows , i think.what is the continuation command at prompt $
please experts

Turbocapitalist 02-09-2019 06:21 AM

Welcome.

Which distro, including version, do you have and which version of expect do you have?

Code:

lsb_release -rd
expect -v


jraju 02-09-2019 06:42 AM

Hi, thanks . those terms i hear for th first time.
i am not having linux system or ubantu.
i want to talk to the router to get instant particulars of status page of the router.
i just use putty and plink latest version to issue commands
but i want to have a kind of batch file to execute it automatically and to wait for user to close.
i am thinking of addding this to the task scheduler and to pop up, say for 3 hours internal period.
distro and version, you mean linux words.
i am having windows 7 ultimate and plan to have dual boot linux.
i do not know anyt anhing about linux operating system. i think that you can download windows 7 linux without any license.
i just noted some commands and making some settings change, i could log on to my pc to the router ip pgae. my putty version is 0.70
thanks for jet speed reply and i appreciate it very much sharing equals caring. thank you.
can i use window linux as windows 7
the example working bat lines
@ echo on
plink x.x.x.x -ladmin -pw xxxxxx
pause
this it goes to the $ pompt.

Turbocapitalist 02-09-2019 06:47 AM

Ok. You can get Linux Mint here: https://linuxmint.com/download.php

It's quite convenient for both beginners and advanced users.

As far as getting going from a legacy operating system, I have heard that there is a tool called Etcher which you can run to burn the image to a USB stick. Then you can test it in Live mode, where it runs from the USB stick and does not install. That will give you a good chance to test it out and decide which distro to try with the dual boot.

Edit: link applies also to Linux Mint: https://www.raspberrypi.org/document...ges/windows.md

jraju 02-09-2019 06:50 AM

Hi, i want help in getting the result of continuing the show status .
Refering to linux books or blogs will take more time please\P S you have given the link of OS. thanks but what is compatible version to my windows 7 ultimate 32 bit. Is linux, developed by so many org , unlike windows
microsoft.
what is tessa\
please give me code help

michaelk 02-09-2019 07:14 AM

You can run a command on the router using plink like the following. You can save the output of the show command using a redirect (>) too.

Code:

plink  -l username -pw password router_ip_address "show status"

jraju 02-09-2019 07:21 AM

your command only leads upto $ prompt. it does not execute "show status"
i have included the quotes also in the command

michaelk 02-09-2019 07:34 AM

Just a stab in the dark.

While that command would work if connecting to a ssh server without knowing your router's make/model (Cisco?) or anything about its operating system it is a bit difficult to provide help.

jraju 02-09-2019 07:59 AM

hi, i KNOW that it is a internal command particular to the router model.
but , only want to know the code to execute like start or run
when i execute with comand prompt , i could get the result. Since i do not know, how to put codes in linux prompt, to be executed in windows .
here is how i access it thro cmd
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.


C:\Windows\System32>plink xxxxxxxx -l user -pw password
$show status
System
Alias Name : xxxxxxxx
Uptime : 0 3:50:26
Date/Time : Thu Jan 1 3:50:26 1970
Firmware Version : xxxxxx

DSL
Operational Status : ADSL2+
Upstream Speed : 621 kbps
Downstream Speed : 12495 kbps

LAN Configuration
IP Address : x.x.x.x
Subnet Mask : z.z.z.z
DHCP Server : Enable
MAC Address : xxxxxxxxxxxxxxx
WAN Configuration
Interface VPI/VCI Encap Droute Protocol IP Address Gateway Status
----------------------------------------------------------
pppoe1 x/xx LLC Off PPPoE xxxxxxxxxxxx xxxxxxxxxxx Up
$
now i have to type in cmd to get. i wnat it auto enabled command

michaelk 02-09-2019 08:49 AM

Code:

plink xxxxxxxx -l user -pw password (show status)
Here is another way to send a command via plink. You can also try running the command from a text file. Otherwise what you want to accomplish might not be possible via plink.

https://www.thegeekstuff.com/2017/05...link-examples/


All times are GMT -5. The time now is 11:24 AM.