Files
SnarfCode/scripts/check_npm_docker.py

17 lines
633 B
Python

import paramiko
import sys
sys.stdout.reconfigure(encoding='utf-8')
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('140.44.4.71', username='snarf', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=5)
stdin, stdout, stderr = ssh.exec_command('docker ps')
print("Docker ps:\n", stdout.read().decode('utf-8', errors='ignore'))
stdin, stdout, stderr = ssh.exec_command('docker exec -i $(docker ps -q -f name=app -f name=npm) find /data -name "*.sqlite* -o -name "*.conf" 2>/dev/null')
print("NPM find:\n", stdout.read().decode('utf-8', errors='ignore'))
ssh.close()