本文整理汇总了Python中ee.core.shellexec.EEShellExec.cmd_exec_stdout方法的典型用法代码示例。如果您正苦于以下问题:Python EEShellExec.cmd_exec_stdout方法的具体用法?Python EEShellExec.cmd_exec_stdout怎么用?Python EEShellExec.cmd_exec_stdout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ee.core.shellexec.EEShellExec
的用法示例。
在下文中一共展示了EEShellExec.cmd_exec_stdout方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getExpirationDays
# 需要导入模块: from ee.core.shellexec import EEShellExec [as 别名]
# 或者: from ee.core.shellexec.EEShellExec import cmd_exec_stdout [as 别名]
def getExpirationDays(self,domain):
# check if exist
if not os.path.isfile('/etc/letsencrypt/live/{0}/cert.pem'
.format(domain)):
Log.error(self,'File Not Found : /etc/letsencrypt/live/{0}/cert.pem'
.format(domain),False)
Log.error(self, "Check logs for reason "
"`tail /var/log/ee/ee.log` & Try Again!!!")
current_date = EEShellExec.cmd_exec_stdout(self, "date -d \"now\" +%s")
expiration_date = EEShellExec.cmd_exec_stdout(self, "date -d \"`openssl x509 -in /etc/letsencrypt/live/{0}/cert.pem"
" -text -noout|grep \"Not After\"|cut -c 25-`\" +%s".format(domain))
days_left = int((int(expiration_date) - int(current_date))/ 86400)
if (days_left > 0):
return days_left
else:
# return "Certificate Already Expired ! Please Renew soon."
return -1
示例2: getExpirationDate
# 需要导入模块: from ee.core.shellexec import EEShellExec [as 别名]
# 或者: from ee.core.shellexec.EEShellExec import cmd_exec_stdout [as 别名]
def getExpirationDate(self,domain):
# check if exist
if not os.path.isfile('/etc/letsencrypt/live/{0}/cert.pem'
.format(domain)):
Log.error(self,'File Not Found : /etc/letsencrypt/live/{0}/cert.pem'
.format(domain),False)
Log.error(self, "Check logs for reason "
"`tail /var/log/ee/ee.log` & Try Again!!!")
expiration_date = EEShellExec.cmd_exec_stdout(self, "date -d \"`openssl x509 -in /etc/letsencrypt/live/{0}/cert.pem"
" -text -noout|grep \"Not After\"|cut -c 25-`\" ".format(domain))
return expiration_date