Python Forum
Automating putty for daily repetitive task
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Automating putty for daily repetitive task
#4
What I do is-
1) connecting to remote desktop.
2) connecting to putty.
3)login in to putty by entering username and password
4)type command:-
bash
cd my_folder
ls
my_file. sh BR0001
5)A menu option comes displaying 43 options.
6)press 1 once it is executed press 2 and so on up to 43.
7)press 0 to exit
8)close the session.
9) again start connecting to putty and repeat the next steps.

After running my_file.sh BR0001
It opens and a menu providing 43 options displays.
And for each steps there are sh files associated with it.when I press 1 then sh file associated with it executes when it completes then press 2 associated sh file executes and so on.

(Aug-30-2018, 06:27 PM)micseydel Wrote: Assuming you're using putty for SSH, your Python code can skip putty entirely and use Paramiko (https://github.com/paramiko/paramiko). Should solve your problem pretty well.
Thank you for the solution.It's helpful.
As I am new to python I am understanding paramiko to achieve it.

(Aug-30-2018, 07:21 PM)heras Wrote: Alternatively, if the remote machine is Unix-like, you may be able to set up a cron job. Cron can run scheduled tasks for you removing the need to SSH into the machine at all.

What is the nature of the input to the .sh file? Is it always the same or predictable?
Thanks for the solution.
The input to .sh is always same. The main sh file takes branch code of customer as an input and it provides menu option, that has 43 options. When I enter 1 this is for changing the bussing date and sh file is written for this so it executes this. Other options also has sh files for different tasks.
There are 20 branch codes and I have to to this 20 times giving their branch code as input.Each branch code is different.

Please guide me
1)How to set up connection with remote desktop.
2) after connecting to remote desktop open putty
3)login to putty
4)typing commands in putty

How can I code these using paramiko?
Any useful links so that I can get idea on how to start and proceed to achieve this.
Reply


Messages In This Thread
RE: Automating putty for daily repetitive task - by Kanchan - Sep-01-2018, 07:12 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020