Page 1 of 1

Scripting execution CE 6.3.5 Dev not completing

Posted: Fri Feb 09, 2018 4:47 pm
by silverspr
Hi jllort
In order to solve the document preview issue reported in an earlier post, I've had 99% success in compiling and converting to Dev 6.3.5. The only part that wasn't successful per the knowledge base instruction was the "scripting" execute described here: https://docs.openkm.com/kcenter/view/ok ... o-635.html

After pasting the code into the code window the Evaluate button did not update "to execute"....I tried running the code as Evaluate: there were no prompts/messages to indicate if the execution was successful or not.

thanks
dale
scripting.PNG
scripting execute

Re: Scripting execution CE 6.3.5 Dev not completing

Posted: Sun Feb 11, 2018 4:12 pm
by jllort
Really is shown in the bottom the execution time in green, that means the script has been executed. What is strange is the execution time does not take any milisecond. However this script only changes the mail of the crontab task, check if they have changed.

Re: Scripting execution CE 6.3.5 Dev not completing

Posted: Mon Feb 12, 2018 6:33 pm
by silverspr
HI jllort, thank you for your help.
I don't really know what I'm looking for in the crontab tasks. I can't tell what the script actually does?
Here are my crontab tasks listed currently. I do not have email enabled which might be part of the problem.
crontabOkM.PNG
crontab tasks
thanks

Re: Scripting execution CE 6.3.5 Dev not completing

Posted: Thu Feb 15, 2018 5:52 pm
by jllort
The server is stopped for some reason at 00:00 ( backup ) ? might be the reason why never has been executed. What happens when you click on ray icon -> that should execute the cron task.

Re: Scripting execution CE 6.3.5 Dev not completing

Posted: Fri Feb 16, 2018 5:47 am
by silverspr
hi, I'm not sure I follow why you think the server is stopped, but then you are the expert!
Nonetheless, when I click on the lightning bolt, the task executes. I've attached another snapshot of the tasks, you can see they all have today's date (Feb 15) which means the tasks have completed.
I reran the scripting execute, I don't see any change to the tasklist.
openkmcron2.PNG
Feb 15 Crontasks
thanks

Re: Scripting execution CE 6.3.5 Dev not completing

Posted: Sat Feb 17, 2018 5:28 pm
by jllort
The task is planned as @daily, that mean will be execute at 00:00 in your server, if the application is running. You can try to change the expression for this one "*/5 * * * *" and should be executed each minute. If the process is not executed each minuted then there's some issue ( consider that if process need more than 5 minutes to be completed the next will not be running until the first be finished ). That will help you to check if cron expression is working. In case is confirmed works, then I suspect the reason is that at you 00:00 the OpenKM might be not running, otherwise the process by cron will be started. The same will happens with "weekly" expression what is executed at 00:00

Re: Scripting execution CE 6.3.5 Dev not completing

Posted: Mon Feb 19, 2018 5:15 pm
by silverspr
Hi, ahhh ok now I see why you were thinking Cron wasn't running. The server does not run 24/7.
Cron is working, I tested by changing the Dashboard Activity Purge to */5 * * * * and it runs as expected.

My only question remaining: What task does the script create, so that I can check for it in Cron, is it already there? If so I presume its the mail task? If not then the script isn't working....which was where we started!

the script:

Code: Select all

import com.openkm.core.DatabaseException;
import com.openkm.dao.CronTabDAO;
import com.openkm.dao.bean.CronTab;

static final String MAIL = "noreply@openkm.com";
 
try {
     for (CronTab ct : CronTabDAO.findAll()) {
          if (ct.getMail().equals(MAIL)) {
               ct.setMail("");
               CronTabDAO.update(ct);
          }
     }
} catch (Exception e) {
    print("Exception: " + e);
} 
thanks
dale

Re: Scripting execution CE 6.3.5 Dev not completing

Posted: Tue Feb 20, 2018 8:03 am
by jllort
I do not understanding the question:
What task does the script create, so that I can check for it in Cron, is it already there? If so I presume its the mail task? If not then the script isn't working....which was where we started!

Re: Scripting execution CE 6.3.5 Dev not completing

Posted: Thu Feb 22, 2018 5:46 am
by silverspr
hi
the script run to complete the migration from CE 6.3.4 to 6.3.5 what does it do? how will I know it executed successfully? Its not clear to me that it completed.
https://docs.openkm.com/kcenter/view/ok ... o-635.html
thanks
dale

Re: Scripting execution CE 6.3.5 Dev not completing

Posted: Fri Feb 23, 2018 7:19 am
by jllort
The script it change all the mail address of the crontab tasks. If the mail address in the crontab task is set to "", then it means has been executed.

Re: Scripting execution CE 6.3.5 Dev not completing

Posted: Fri Feb 23, 2018 7:48 pm
by silverspr
HI, yes that makes sense after looking at the script again!
The mail column is empty in my cron tasks, see image posted earlier. Is the mail column in cron tasks the right place to look? I haven't set up email on this server does that make a difference.

thanks again

Re: Scripting execution CE 6.3.5 Dev not completing

Posted: Sat Feb 24, 2018 7:32 pm
by jllort
Yes this is the right column. That is a correction for previous OpenKM versions to remove default mail address and set to empty.