LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > General
User Name
Password
General This forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!

Notices


Reply
  Search this Thread
Old 02-09-2019, 07:18 AM   #1
jraju
LQ Newbie
 
Registered: Feb 2019
Posts: 0

Rep: Reputation: Disabled
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
 
Old 02-09-2019, 07:21 AM   #2
Turbocapitalist
Senior Member
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 3,688
Blog Entries: 3

Rep: Reputation: 1651Reputation: 1651Reputation: 1651Reputation: 1651Reputation: 1651Reputation: 1651Reputation: 1651Reputation: 1651Reputation: 1651Reputation: 1651Reputation: 1651
Welcome.

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

Code:
lsb_release -rd
expect -v
 
Old 02-09-2019, 07:42 AM   #3
jraju
LQ Newbie
 
Registered: Feb 2019
Posts: 0

Original Poster
Rep: Reputation: Disabled
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.

Last edited by jraju; 02-09-2019 at 07:47 AM.
 
Old 02-09-2019, 07:47 AM   #4
Turbocapitalist
Senior Member
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 3,688
Blog Entries: 3

Rep: Reputation: 1651Reputation: 1651Reputation: 1651Reputation: 1651Reputation: 1651Reputation: 1651Reputation: 1651Reputation: 1651Reputation: 1651Reputation: 1651Reputation: 1651
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

Last edited by Turbocapitalist; 02-09-2019 at 07:53 AM.
 
Old 02-09-2019, 07:50 AM   #5
jraju
LQ Newbie
 
Registered: Feb 2019
Posts: 0

Original Poster
Rep: Reputation: Disabled
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

Last edited by jraju; 02-09-2019 at 07:55 AM.
 
Old 02-09-2019, 08:14 AM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 18,104

Rep: Reputation: 2521Reputation: 2521Reputation: 2521Reputation: 2521Reputation: 2521Reputation: 2521Reputation: 2521Reputation: 2521Reputation: 2521Reputation: 2521Reputation: 2521
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"
 
Old 02-09-2019, 08:21 AM   #7
jraju
LQ Newbie
 
Registered: Feb 2019
Posts: 0

Original Poster
Rep: Reputation: Disabled
your command only leads upto $ prompt. it does not execute "show status"
i have included the quotes also in the command
 
Old 02-09-2019, 08:34 AM   #8
michaelk
Moderator
 
Registered: Aug 2002
Posts: 18,104

Rep: Reputation: 2521Reputation: 2521Reputation: 2521Reputation: 2521Reputation: 2521Reputation: 2521Reputation: 2521Reputation: 2521Reputation: 2521Reputation: 2521Reputation: 2521
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.
 
Old 02-09-2019, 08:59 AM   #9
jraju
LQ Newbie
 
Registered: Feb 2019
Posts: 0

Original Poster
Rep: Reputation: Disabled
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

Last edited by jraju; 02-09-2019 at 09:01 AM.
 
Old 02-09-2019, 09:49 AM   #10
michaelk
Moderator
 
Registered: Aug 2002
Posts: 18,104

Rep: Reputation: 2521Reputation: 2521Reputation: 2521Reputation: 2521Reputation: 2521Reputation: 2521Reputation: 2521Reputation: 2521Reputation: 2521Reputation: 2521Reputation: 2521
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/
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Best method for automatic command execution every time a system boots up Ahsaniqbalkmc Linux - Newbie 8 08-14-2013 08:47 PM
[SOLVED] how to write a batch file in linux?and what are batch(.bat) file benefits? karthilin Linux - Newbie 8 10-15-2012 03:10 PM
Automatic execution of a command after login openart Linux - Newbie 5 10-29-2004 02:44 AM
shell script works form command line but not form crontab saifee General 1 10-14-2004 11:27 AM
how do I copy a whoel folder form one directory to another form the command line? zwyrbla Linux - Newbie 8 08-24-2004 07:40 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > General

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration