I want to pass argument to shell script dynamically through paramiko. I tried but I can't achieve it. If anyone knows please let me know.
Below is my code:
Python code:
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect("192.168.10.5", username='root', password='root')
backup_name="test_backup"
stdin, stdout, stderr = client.exec_command('./backup.sh',backup_name)
stdin.write('next')
stdin.flush()
Shell Script(backup.sh):
#!/bin/bash
virsh snapshot-create-as one-96 "'$1'"
I want to create backup with the backup name mentioned in the python code through shell script. How to pass that name in exec_command to shell script? Thanks in Advance!!!!
exec_command('./backup.sh %s' % backup_name)