当前位置: 首页>>代码示例>>Python>>正文


Python EEShellExec.cmd_exec_stdout方法代码示例

本文整理汇总了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
开发者ID:cdsalmons,项目名称:easyengine,代码行数:22,代码来源:sslutils.py

示例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
开发者ID:Backenkoehler,项目名称:easyengine,代码行数:14,代码来源:sslutils.py


注:本文中的ee.core.shellexec.EEShellExec.cmd_exec_stdout方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。