注册:电子邮件通知程序 [英] Reg: E-Mail Notifier

查看:185
本文介绍了注册:电子邮件通知程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要求:

我必须根据三个功能条件创建一个自动电子邮件通知程序.此工具必须每1小时运行一次,格式为0600至1800
1)检查日志文件中是否有任何通信错误.
2)检查是否有未处理的作业
3)检查上一次收到的作业与当前日期时间之间的时差,如果时差超过1小时.

----如果没有错误,没有未处理的分配,并且时间差超过1小时,则必须向客户发送外部邮件.
----如果通讯日志中有错误或任何未处理的分配,则必须发送内部邮件.


我的问题:
根据哪个更好的要求,创建Windows服务或使用sql作业代理并将其安排为每1个小时?

我觉得Windows服务可以做到,但是,我们已经有一个电子邮件通知程序存储的proc,它使用sql作业进行调度.

我已经为第二个和第三个需求创建了一个存储的proc(未处理的检入和计算时差),但是我无法执行第一个需求

通信日志是由称为墨卡托的某种工具生成的,它生成一个txt文件(文件名为G_20100319144219.txt).
它每5分钟生成一个新的日志文件.
但是服务或我必须做的工作必须每隔一小时运行一次.
因此我需要选择最新的日志文本文件并扫描字符串以查找< ExecutionSummary MapStatus =有效" mapreturn ="0" ElapsedSec ="0.0119" BurstRestartCount ="0">此行
如果文件有效,则没有错误,否则有错误.
所以
1)我如何选择最新文件?并检查是否有文字?
2)我可以通过存储的过程或SQL做到这一点?如果是这样,我可以安排它在工作中.或
3)我可以通过.BAT文件吗?我找到了bat文件的代码,该代码实际上显示了最新文件.但我不知道如何正确使用它吗?

Requirement:

I have to create an automatic email notifier based on three functional conditions.this tool has to run every one hr form 0600 to 1800
1) check if there are any communication errors in the log file.
2) check if there are any unprocessed assignments
3) check the time difference between the last assignment recieved and the current date time and if the difference is more than 1 hr.

----if there are no errors and no unprocessed assignments and time diff is more than 1 hr an external mail has to be sent to the customers.
----if there are errors in comm logs or any unprocessed assignments left then an internal mail has to be sent.


my questions:
Based on the requirement which one is better , creating a windows service or using sql job agent and schedule it for every one hr?

I felt that a windows service can do it but, we already have a email notifier stored proc which is scheduled using sql jobs.

i have already created a stored proc for the second and the third requirement ( checkin for hte unprocessed and calculating the time difference), but im unable to do the first one

the comm logs are generated by some tool called mercator, it generates a txt file (name of file is G_20100319144219.txt) .
It generates a new log file every 5 minutes.
but the servvice or the job i have to do has to run every one hr.
so i need to pick the latest log text file and scan the string for "<ExecutionSummary MapStatus="Valid" mapreturn="0" ElapsedSec="0.0119" BurstRestartCount="0"> " this line
if the file has valid then no errors or else it has errors.
so
1) how can i pick the most recent file? and scan if for the text?
2) can i do it through a stored proc or sql ? if so i can schedule it in jobs. or
3)Can i do it throug .BAT files? i found the code for bat file which actually shows the most recent file. but i dont kno how to properly use it?

@rem NEWESTF.BAT -
@rem Whatever.bat -
@echo off
cd C:\
setlocal enabledelayedexpansion

set d=00
set t=0

for /f "tokens=*" %%a in ('dir /b /a-d /s') do (
   set dt=%%~ta
   set dtmp=!dt:~6,4!!dt:~3,2!!dt:~0,2!
   set ttmp=!dt:~-5,2!!dt:~-2,2!
   if !dtmp! GEQ !d! (
      if !dtmp! GTR !d! (
         set d=!dtmp!
         set t=!ttmp!
         set l=%%a
      ) else (
         if !ttmp! GTR !t! (
            set d=!dtmp!
            set t=!ttmp!
            set l=%%a
         )
      )
   )
)

endlocal & set lastfile=%l%

echo %lastfile%

echo.
pause
exit



多数民众赞成在蝙蝠file.u可以执行它,看,它显示了具有路径的最新文件,但我不知道如何使用它?而且这段代码是第一次工作,我觉得它有一个时间滞后,我不知道为什么这样做,因为我不了解一些dos命令.如果我修改了一个不同的文件并执行了它,则需要一些时间.我的意思是最初它显示了最近的文件,但是经过任何修改后,它又显得微不足道了,如果我在大约一个小时后执行它,它又会显示新的文件.
3)如果我可以使用上面的bat文件知道下一个文件的名称,我可以将txt文件插入sql中的某个表中,并使用一些关键字"LIKE"对其进行扫描.
4)我的领导要我使用sql作业代理做,我可以在其中使用bat文件或任何存储的proc,当我问他时,他说尝试在sql中做,因为已经有一个进程在sql代理中运行了,他没有我更喜欢Windows服务,如果他不能完成,那就去Windows服务.就我所知,他是sql方面的专家,我什至不知道sql方面的知识,所以我不希望他知道我是哪位新手.

是的,已经存在的进程不检查任何时间差,而是安排一个sql作业计划运行存储的proc,以检查时间并在时间差大于某个可配置时间的情况下发送邮件.

[修改:删除了代码块周围的引号以纠正颜色编码]



Thats the bat file.u can execute it and see, it shows the recent file with the path but i dont know how to use it? and this code works for the first time and i feel it has a time lag, i dont kno wat it does as i donot understand a bit of dos commands. if i modify a different file and execut it, it takes some time.i mean initially it shows the recent one but after any modifications it dosent, if i execute it after about an hr, it again shows new one.
3) if i can know the name of the next file using the bat file above can i insert the txt file into the some table in sql and scan it by using some keyword ''LIKE'' .
4) My lead wants me to do using sql jobs agent, where i can use bat files or any stored procs, When i asked him, he said try to do it in sql as thers already one process running scheduled in sql agent, he doesnt prefer windows services, he if it cannot be done then go with windows services and as far as i kno he is an expert in sql, and i dont kno even little bit in sql, so i dont want him to know that im a fresher.

And Yea the already existing process dosent check anything except for the time difference a sql job is scheduled to run a stored proc which checks for the time and sends a mail if the time diff is more than some configurable time.

[Modified: removed quotes surrounding code block to correct the color coding]

推荐答案

Lakshmana Kumar Vepuri写道:
Lakshmana Kumar Vepuri wrote:

据我所知,他是sql方面的专家,而且我什至不了解sql,所以我不想让他知道我是新鲜人.

as far as i kno he is an expert in sql, and i dont kno even little bit in sql, so i dont want him to know that im a fresher.



您的企业文化是一场灾难,将导致失败多于成功.也许他也说谎.也许没有人知道他们在做什么.

如果有人要求我完成开发人员的成功,那么我会说:我还不知道该怎么做,你能告诉我还是推荐一些参考文献? ".如果您通过在下一个星期一参加工作而获得了支持,并且在整个周末的辛勤工作中学习了一些新知识,那么您很快就会成为非常有价值的员工,因为您说实话,并且为维护公司利益而行动.项目,以及努力改善自己.



Your corporate culture is a disaster and will lead to failure more often than success. Perhaps he''s lying too. Perhaps no-one there has any clue what they are doing.

If I was asked for the one thing that led to my success as a developer, I''d say a willingness to say ''I don''t know how to do that yet, could you show me, or recommend some references ?''. If you back that up by showing up for work the following Monday with a good working knowledge from working hard all weekend to learn about something new, you will soon become a very valued employee, because you tell the truth, and act in the interests of the project, as well as working to better yourself.


这篇关于注册:电子邮件通知程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆