我很难弄清楚如何使用cfschedule并希望有人可以帮助我解开。
我可以安排好任务。管理员门户指示任务已运行,但我没有看到发生任何事情。
<cfschedule
action="update"
task="update_printer_status"
operation="HTTPRequest"
startDate="03/26/2018"
startTime="12:00 PM"
url="http://localhost:8000/source/update_status.cfm"
interval="1800" />
出于测试目的,我只是想让它将日期/时间保存到日志文件中。但是日志文件是空的。这是我的日志文件。
<!--- Read in existing contents of file --->
<cffile
action="read"
file = "c:\temp\update_log.txt"
variable = "file_contents"
>
<!--- Set additional content --->
<cfset br = chr(13) & chr(10) />
<cfset date="#DateFormat(Now())#, #TimeFormat(Now())#">
<!--- Write string back to log file --->
<cfset update_string="#file_contents##br#Update initiated: #date#">
<cfscript>
FileWrite("update_string", "#update_string#");
ustr = FileRead("update_string");
FileWrite("c:\temp\update_log.txt", "#ustr#");
</cfscript>
谁能告诉我这里我做错了什么?
答案 0 :(得分:0)
我的问题是我已将模块直接保存在受保护模块中。由于未记录上下文,因此管理员没有看到它。
要解决,我只是将文件移动到公共目录。