File tree 1 file changed +25
-2
lines changed
1 file changed +25
-2
lines changed Original file line number Diff line number Diff line change 8
8
# Author: midoks <[email protected] >
9
9
# ---------------------------------------------------------------------------------
10
10
11
+ import os
11
12
import core .mw as mw
13
+ from utils .crontab import crontab
14
+ from croniter import croniter
15
+ from datetime import datetime
12
16
13
17
# 识别linux计划任务
14
18
def init_cron ():
19
+ file = ''
20
+ cron_file = [
21
+ '/var/spool/cron/crontabs/root' ,
22
+ '/var/spool/cron/root' ,
23
+ ]
24
+ for i in cron_file :
25
+ if os .path .exists (i ):
26
+ file = i
15
27
16
- content = mw .execShell ("crontab -l" )
17
- print (content )
28
+ if file == "" :
29
+ return True
30
+
31
+ # content = mw.execShell("crontab -l")
32
+ with open (file ) as f :
33
+ for line in f .readlines ():
34
+ cron_line = line .strip ()
35
+ if cron_line .startswith ("#" ):
36
+ continue
37
+ print (cron_line )
38
+
39
+ # cron_list = content.split("\n")
40
+ # print(cron_list)
You can’t perform that action at this time.
0 commit comments