Simple Linux Panel
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mdserver-web/web/admin/setup/init_cron.py

40 lines
1.2 KiB

2 months ago
# coding:utf-8
# ---------------------------------------------------------------------------------
# MW-Linux面板
# ---------------------------------------------------------------------------------
# copyright (c) 2018-∞(https://github.com/midoks/mdserver-web) All rights reserved.
# ---------------------------------------------------------------------------------
# Author: midoks <midoks@163.com>
# ---------------------------------------------------------------------------------
import os
2 months ago
import core.mw as mw
from utils.crontab import crontab
from croniter import croniter
from datetime import datetime
2 months ago
# 识别linux计划任务
def init_cron():
file = ''
cron_file = [
'/var/spool/cron/crontabs/root',
'/var/spool/cron/root',
]
for i in cron_file:
if os.path.exists(i):
file = i
2 months ago
if file == "":
return True
# content = mw.execShell("crontab -l")
with open(file) as f:
for line in f.readlines():
cron_line = line.strip()
if cron_line.startswith("#"):
continue
print(cron_line)
# cron_list = content.split("\n")
# print(cron_list)