问题描述:

I have many loaded shell scripts in UNIX.

I don't know more about shell scripting. But, I know Python programming.

I have to access multiple server using python.

Anyone guide for this?

网友答案:

Assuming you have SSH access to the server and want to remotely write the script:

  1. Connect the SSH session
  2. You have to install a text editor. nano is a very simple one. To install it on Debian based systems use sudo apt-get install nano
  3. Now create a file using nano filename.py. If you aren't using nano as your editor create the file with touch filename.py and get into the file with your editor.
  4. Write the script
  5. Add execute permission chmod +x filename.py
  6. Run file with python filename.py or python3 filename.py

NOTE: The script will stop running after you close the SSH session so I recommend using screen and running the script in a screen session.

If you are trying to connect to a server with ssh in Python use the SSH library.

相关阅读:
Top