0

I regularly login to PuTTY and run the following commands to complete a task.

1st Command :

cd/u01/app/oracle/user_projects/domains/COLLECT/EOD/bin_arm

2nd Command :

./FileUpload.sh

3rd Command :

cd/u01/app/oracle/user_projects/domains/COLLECT/EOD/bin_arm

4th Command :

./execute_eodarx.sh

How can I automate this with the help of batch or other scripting?

I need to run these commands synchronously. (The next command is to run after the completion of the previous command.)

robinCTS
  • 4,327
  • 4
  • 20
  • 29
user9749652
  • 11
  • 1
  • 1
  • 6

2 Answers2

1

You practically wrote the script already. If you put all four commands in a file on the server, then you can run it via sh myscript.sh and you have the batch script.

(If you also want it to be runnable as ./myscript.sh, first add the #!/bin/sh header at the top, then use chmod a+x myscript.sh to mark the file as executable.)

u1686_grawity
  • 426,297
  • 64
  • 894
  • 966
  • thanks for your comments guys, @grawity, can i run this commands serially in windows environment e.g put all the commands in a batch file and run it with the help of Windows task scheduler to automate the process? – user9749652 Jun 27 '18 at 03:22
0

If you are using any Windows OS , try using Multi Tabbed Puty

It has features like save and manage putty sessions and automatically run scripts whenever the sessions are started.

To run commands automatically after logging in ,

  • Right click on your Putty Session from Servers and select Properties
  • Click on Scripts tab in the newly opened dialog box
  • In the box provided, you can add the commands which will be run after login You can also specify the wait period too after which the commands will be executed.
  • Irrespective of platform. If you use tmux you don't need Multi tabbed Putty, since it can do tab. It can also split the screen – KeshV Mar 16 '20 at 22:26