$ pip install fabric
python
from fabric import Connection
import psutil
python
def connect_server():
c = Connection('your_server_address', user='your_username', connect_kwargs={'password': 'your_password'})
python
def run_command():
result = c.run('your_command', hide=True)
print(result.stdout.strip())
python
def upload_file():
c.put('local_file_path', 'remote_file_path')
python
def download_file():
c.get('remote_file_path', 'local_file_path')
python
def main():
connect_server()
run_command()
upload_file()
download_file()
$ fab main