import os
ip = '192.168.1.123'
ip = ip.replace('.','\\.')
SourceFile = '/root/.ssh/known_hosts'
UpdateFile = '/root/.ssh/known_hosts'
params = (SourceFile, ip, UpdateFile)
result = os.system("cp %s /tmp/known_hosts.$$ ;awk '$1!~/^%s/ {print ; }' /tmp/known_hosts.$$ > %s;rm -rf /tmp/known_hosts.$$"% params) == 0
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment