Scripting execution CE 6.3.5 Dev not completing

OpenKM has many interesting features, but requires some configuration process to show its full potential.
Forum rules
Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
Post Reply
silverspr
Senior Boarder
Senior Boarder
Posts: 75
Joined: Thu Aug 21, 2014 12:58 pm

Scripting execution CE 6.3.5 Dev not completing

Post by silverspr » Fri Feb 09, 2018 4:47 pm

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

jllort
Moderator
Moderator
Posts: 10347
Joined: Fri Dec 21, 2007 11:23 am
Location: Sineu - ( Illes Balears ) - Spain
Contact:

Re: Scripting execution CE 6.3.5 Dev not completing

Post by jllort » Sun Feb 11, 2018 4:12 pm

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.

silverspr
Senior Boarder
Senior Boarder
Posts: 75
Joined: Thu Aug 21, 2014 12:58 pm

Re: Scripting execution CE 6.3.5 Dev not completing

Post by silverspr » Mon Feb 12, 2018 6:33 pm

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

jllort
Moderator
Moderator
Posts: 10347
Joined: Fri Dec 21, 2007 11:23 am
Location: Sineu - ( Illes Balears ) - Spain
Contact:

Re: Scripting execution CE 6.3.5 Dev not completing

Post by jllort » Thu Feb 15, 2018 5:52 pm

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.

silverspr
Senior Boarder
Senior Boarder
Posts: 75
Joined: Thu Aug 21, 2014 12:58 pm

Re: Scripting execution CE 6.3.5 Dev not completing

Post by silverspr » Fri Feb 16, 2018 5:47 am

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

jllort
Moderator
Moderator
Posts: 10347
Joined: Fri Dec 21, 2007 11:23 am
Location: Sineu - ( Illes Balears ) - Spain
Contact:

Re: Scripting execution CE 6.3.5 Dev not completing

Post by jllort » Sat Feb 17, 2018 5:28 pm

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

silverspr
Senior Boarder
Senior Boarder
Posts: 75
Joined: Thu Aug 21, 2014 12:58 pm

Re: Scripting execution CE 6.3.5 Dev not completing

Post by silverspr » Mon Feb 19, 2018 5:15 pm

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

jllort
Moderator
Moderator
Posts: 10347
Joined: Fri Dec 21, 2007 11:23 am
Location: Sineu - ( Illes Balears ) - Spain
Contact:

Re: Scripting execution CE 6.3.5 Dev not completing

Post by jllort » Tue Feb 20, 2018 8:03 am

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!

silverspr
Senior Boarder
Senior Boarder
Posts: 75
Joined: Thu Aug 21, 2014 12:58 pm

Re: Scripting execution CE 6.3.5 Dev not completing

Post by silverspr » Thu Feb 22, 2018 5:46 am

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

jllort
Moderator
Moderator
Posts: 10347
Joined: Fri Dec 21, 2007 11:23 am
Location: Sineu - ( Illes Balears ) - Spain
Contact:

Re: Scripting execution CE 6.3.5 Dev not completing

Post by jllort » Fri Feb 23, 2018 7:19 am

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.

silverspr
Senior Boarder
Senior Boarder
Posts: 75
Joined: Thu Aug 21, 2014 12:58 pm

Re: Scripting execution CE 6.3.5 Dev not completing

Post by silverspr » Fri Feb 23, 2018 7:48 pm

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

jllort
Moderator
Moderator
Posts: 10347
Joined: Fri Dec 21, 2007 11:23 am
Location: Sineu - ( Illes Balears ) - Spain
Contact:

Re: Scripting execution CE 6.3.5 Dev not completing

Post by jllort » Sat Feb 24, 2018 7:32 pm

Yes this is the right column. That is a correction for previous OpenKM versions to remove default mail address and set to empty.

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests