0
我想創建一個與RHN Satellite的API接口的Python腳本。下面的代碼安排了一個遠程命令,可以立即在指定的服務器上運行(var id)。問題在於Satellite服務器在我指定後的兩個小時內調度命令。我無法找到這發生的地方。 Satellite服務器和客戶端都是RHEL6。這裏是我的代碼:Python腳本與RHN Satellite的API接口
#!/bin/python
import xmlrpclib
from datetime import date, datetime, time, timedelta
from sys import argv
import socket
import os
SATELLITE_URL = "https://URL"
SATELLITE_LOGIN = "username"
SATELLITE_PASSWORD = "password"
client = xmlrpclib.Server(SATELLITE_URL, verbose=0)
key = client.auth.login(SATELLITE_LOGIN, SATELLITE_PASSWORD)
id = [] #Satellite server ID
script = "#!/bin/sh \n yum update -y"
def schedule_script():
earliest_occurrence = xmlrpclib.DateTime()
print earliest_occurrence
client.system.scheduleScriptRun(key, id, "root", "root", 300, script, earliest_occurrence)
schedule_script()
client.auth.logout(key)
當我打印變量「earliest_occurrence」它打印當前時間。當我在Satellite服務器上執行「日期」時,它會輸出正確的時間。
任何幫助將不勝感激。謝謝!