nnCron not working properly

nnCron and nnCron LITE discussion

nnCron not working properly

Postby archu » Mon, 10 Oct 2005, 15:48

Hi all,
In the nnCron log it shows that file was run but it doesn't give desired output ie mails are not going and database is not get updated.
If the file is run mannually it gives the output.
it's urgent plz reply :(

Thanking you,
Archu.
archu
 
Posts: 3
Joined: Mon, 10 Oct 2005, 15:20

Postby VK » Mon, 10 Oct 2005, 15:55

Please, give us more info: nnCron build, the text of the task, which is not working, the log info etc...
CU
VK
User avatar
VK
 
Posts: 680
Joined: Wed, 14 Jul 2004, 19:17

more info of nncron task

Postby archu » Wed, 19 Oct 2005, 07:49

the code of the file to run its a asp file to be run at 8:00 am


<!-- #include virtual="Inc/functions.asp"-->
<html>
<head>
<title>Crons Check 08:00 </title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<%
'********* *********
Set rsOrderDetail = Server.CreateObject("Adodb.Recordset")
Set rsOrderDetail1 = Server.CreateObject("Adodb.Recordset")



nowDate = FormatDateTime(Now, 2)
nowDateArr = Split(nowDate,"/")

'08:00 Hours Mail :

strSQL = "select * from tbl_order_details where istatus = '4' and date(Deadline)<='"& nowDateArr(2) &"-"& nowDateArr(1) &_
"-" & nowDateArr(0) & "'"
rsOrderDetail.Open strSQL,Conn,3,3

While Not rsOrderDetail.eof
'''' Retreiving records for given project_id ''''
set rsGetValues= server.CreateObject("Adodb.Recordset")
sqlGetValues="select * from tbl_order_details as ord, tbl_users as user, tbl_project_assign as prj_assign where prj_assign.Project_Id=ord.POrder_id and prj_assign.Writer_Id=user.User_Id and istatus='4' and istatusflag='4' and ord.POrder_id=" & rsOrderDetail("POrder_Id")
rsGetValues.open sqlGetValues,conn

Set rsUserDetail = Server.CreateObject("Adodb.Recordset")
strSel1 = "Select * from tbl_users where User_Id = " & rsOrderDetail("SelWriterId")
rsUserDetail.Open strSel1,Conn,3,3
strEmailId = rsUserDetail("vEmailId")

if rsUserDetail("vEmailId1") <> "" then
strEmailId =strEmailId & "," & rsUserDetail("vEmailId1")
end if

Set rsEmailDetail = Server.CreateObject("Adodb.Recordset")
strSQLEmailBody = "Select * from tbl_emailbody where PEmail_id = 61" ''''''
rsEmailDetail.Open strSQLEmailBody,Conn,3,3

EmailFrom = rsEmailDetail("VMailFrom")
emailsubject = rsEmailDetail("VSubject_Line")
Emailbody = rsEmailDetail("VEmail_Body")

'EmailTO=rsEmailDetail("vEmailTo")

'if EmailTO = "Writer" then
intSendFlag=2
intToId=rsUserDetail("User_Id")

' end if

'''' Replacing varibles in email body with value from database ''''
iJob_id=rsOrderDetail("POrder_Id")
'Mail.Body = Emailbody
Emailbody=funMergeVariables(iJob_id,Emailbody,"4")

''''' merging data in Subject Line by calling funMergeVariables function '''''
emailsubject=funMergeVariables(iJob_id,emailsubject,"4")

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Set myMail=CreateObject("CDO.Message")
myMail.Subject=emailsubject
myMail.From=EmailFrom
myMail.To=strEmailId
myMail.HTMLBody =Emailbody
myMail.Send
set myMail=nothing

emailsubject=replace(emailsubject,"'","''")
Emailbody=Replace(Emailbody,"'","''")

strDate=datepart("yyyy",now) &"-" &datepart("m",now) &"-" &datepart("d",now)
strTime=time

'strDate=datepart("yyyy",now) &"-" &datepart("m",now) &"-" &datepart("d",now) & "-" & datepart("h",now) & "-" & datepart("n",now) & "-" & datepart("s",now)
Set RecAddMessage=Server.CreateObject("Adodb.Recordset")
SqlAddMessage="Insert into tbl_messages (vMessage,iSendFlag,vMailSubject,vMessageFrom,iWriter_User_Id,dtSendDate) values('" & Emailbody & "'," &_
intSendFlag & ",'" & emailsubject & "','" & EmailFrom & "'," & intToId & ",'"&strDate&" "&strTime &"')"
'Response.Write("SqlAddMessage" &SqlAddMessage)
RecAddMessage.Open SqlAddMessage,conn

rsOrderDetail.MoveNext

Wend


'08:00 Hours Mail :
strSQL = "select * from tbl_order_details where istatus != '7' and istatus != '6.5' and date(Deadline)<='"& nowDateArr(2) &"-"& nowDateArr(1) &_
"-" & nowDateArr(0) & "' and Deadline > '0000-00-00' "
rsOrderDetail1.Open strSQL,Conn,3,3

While Not rsOrderDetail1.eof
'''' Retreiving records for given project_id ''''
'set rsGetValues= server.CreateObject("Adodb.Recordset")
'sqlGetValues="select * from tbl_order_details as ord, tbl_users as user, tbl_project_assign as prj_assign where prj_assign.Project_Id=ord.POrder_id and prj_assign.Writer_Id=user.User_Id and istatus=4 and ord.POrder_id=" & rsOrderDetail("POrder_Id")
'rsGetValues.open sqlGetValues,conn

strEmailId = rsOrderDetail1("vEmailAdd")

Set rsEmailDetail1 = Server.CreateObject("Adodb.Recordset")
strSQLEmailBody = "Select * from tbl_emailbody where PEmail_id = 33" ''''''emailbodyid yet to check HARD-CODED
rsEmailDetail1.Open strSQLEmailBody,Conn,3,3
iJob_id=rsOrderDetail1("POrder_Id")
EmailFrom = rsEmailDetail1("VMailFrom")
emailsubject = rsEmailDetail1("VSubject_Line")
Emailbody = rsEmailDetail1("VEmail_Body")

EmailTO=rsEmailDetail1("vEmailTo")
'if EmailTO = "Customer" then
intSendFlag=1
'strEmailId = rsGetValues("vEmailAdd")
intToId=iJob_id
'end if
'if EmailTO = "Writer" then
'intSendFlag=2
' strEmailId = rsGetValues("vEmailId")
'intToId=rsGetValues("User_Id")
' if rsGetValues("vEmailId1") <> "" then
' strEmailId =strEmailId & "," & rsGetValues("vEmailId1")
' end if
' end if

'''' Replacing varibles in email body with value from database ''''

'Mail.Body = Emailbody
statusflag=rsOrderDetail1("istatus")
Emailbody=funMergeVariables(iJob_id,Emailbody,statusflag)

''''' merging data in Subject Line by calling funMergeVariables function '''''
emailsubject=funMergeVariables(iJob_id,emailsubject,statusflag)

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''


Set myMail=CreateObject("CDO.Message")
myMail.Subject=emailsubject
myMail.From=EmailFrom
myMail.To=strEmailId
myMail.HTMLBody =Emailbody
myMail.Send
set myMail=nothing

emailsubject=replace(emailsubject,"'","''")
Emailbody=Replace(Emailbody,"'","''")

strDate=datepart("yyyy",now) &"-" &datepart("m",now) &"-" &datepart("d",now)
strTime=time


Set RecAddMessage=Server.CreateObject("Adodb.Recordset")
SqlAddMessage="Insert into tbl_messages (vMessage,iSendFlag,vMailSubject,vMessageFrom,iWriter_User_Id,dtSendDate) values('" & Emailbody & "'," &_
intSendFlag & ",'" & emailsubject & "','" & EmailFrom & "'," & intToId & ",'"&strDate&" "&strTime &"')"
'Response.Write("SqlAddMessage" &SqlAddMessage)
RecAddMessage.Open SqlAddMessage,conn

rsOrderDetail1.MoveNext

Wend

strDate1=datepart("yyyy",date) &"-" &datepart("m",date) &"-" &datepart("d",date)
set Recinsertcrondetails=Server.CreateObject("Adodb.Recordset")
Sqlinsertcrondetails="update tbl_cron_details set rundate='" & strDate1 & "', runtime='" &time &"' where vcronname= 'Crons Eight Ten'"
Recinsertcrondetails.open Sqlinsertcrondetails,conn


%>
</body>
</html>
<script language="JavaScript">
//alert("WORKING")
window.close();
</script>


*********end of the code *******

the log details are :

08:00:00 7864 TASK: eightamtask
08:00:00 7864 Start: C:\Program Files\Internet Explorer\iexplore.exe http://localhost/cron_eight_am.asp

my problem is in log it shows file run at 8:00 but no output.

Thanking you,
Archu


08:00:00 7864 Start result: 0
archu
 
Posts: 3
Joined: Mon, 10 Oct 2005, 15:20

Postby VK » Wed, 19 Oct 2005, 10:30

Please, read carefully my initial message: I was asking for nnCron build number and the text of the task which is not working...

At the moment, I'm pretty sure your task is not authorized. Try to add smth like:
Code: Select all
AsLoggedUser
LoadProfile

Hope this will solve the problem.
CU
VK
User avatar
VK
 
Posts: 680
Joined: Wed, 14 Jul 2004, 19:17

nnCron build number

Postby archu » Wed, 19 Oct 2005, 12:46

here is the build number ( nnCron 1.91.1052 )
and i cannot understand where to add the code for the authoirized user
i.e. AsLoggedUser
LoadProfile

Please give an example
archu
 
Posts: 3
Joined: Mon, 10 Oct 2005, 15:20

Postby VK » Wed, 19 Oct 2005, 12:56

Code: Select all
#( task_name
AsLoggedUser
LoadProfile
Time: * * * * * *
Action:
\ smth useful here
)#


Please, take a look in the docs for more detailed info.
CU
VK
User avatar
VK
 
Posts: 680
Joined: Wed, 14 Jul 2004, 19:17


Return to nnCron forum (English)

Who is online

Users browsing this forum: No registered users and 0 guests

cron