示例#1
0
    def checkBackup(self):
        if cache.get('check_backup'): return None
        #检查备份脚本是否存在
        filePath = public.GetConfigValue('setup_path') + '/panel/script/backup'
        if not os.path.exists(filePath):
            public.downloadFile(
                public.GetConfigValue('home') + '/linux/backup.sh', filePath)
        #检查日志切割脚本是否存在
        filePath = public.GetConfigValue(
            'setup_path') + '/panel/script/logsBackup'
        if not os.path.exists(filePath):
            public.downloadFile(
                public.GetConfigValue('home') + '/linux/logsBackup.py',
                filePath)
        #检查计划任务服务状态

        import system
        sm = system.system()
        if os.path.exists('/etc/init.d/crond'):
            if not public.process_exists('crond'):
                public.ExecShell('/etc/init.d/crond start')
        elif os.path.exists('/etc/init.d/cron'):
            if not public.process_exists('cron'):
                public.ExecShell('/etc/init.d/cron start')
        elif os.path.exists('/usr/lib/systemd/system/crond.service'):
            if not public.process_exists('crond'):
                public.ExecShell('systemctl start crond')
        cache.set('check_backup', True, 3600)
示例#2
0
 def GetExecShellMsg(self,get):
     fileName = '/tmp/panelShell.pl';
     if not os.path.exists(fileName): return 'FILE_SHELL_EMPTY';
     status = not public.process_exists('bash',None,'/tmp/panelShell.sh')
     return public.returnMsg(status,public.GetNumLines(fileName,200));