Bug 13585 - HEA - activate cronjob by default
Summary: HEA - activate cronjob by default
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Command-line Utilities (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Julian FIOL
QA Contact: Jonathan Druart
URL: http://hea.koha-community.org
Whiteboard:
Keywords:
Depends on: 11926 13149
Blocks: 14608
  Show dependency treegraph
 
Reported: 2015-01-15 09:22 UTC by Martin Renvoize
Modified: 2016-12-05 21:30 UTC (History)
14 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:


Attachments
Bug 13585 : Add a cronjob which send UsageStats monthly. (3.00 KB, patch)
2015-07-16 13:08 UTC, Julian FIOL
Details | Diff | Splinter Review
[SIGNED OFF] Bug 13585: Add a cronjob which send UsageStats monthly. (3.26 KB, patch)
2015-09-01 15:33 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 13585: Add a cronjob which send UsageStats monthly. (3.32 KB, patch)
2015-09-04 07:37 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Renvoize 2015-01-15 09:22:05 UTC
Bug #11926 added the ability for koha to collect usage statistics.

Problem is, to set them up you have to both change the system preferences and jump on the server to add the cron script to your crontab.

I think the server-side bit should be done at install time thus allwoing simple on/off switching via the staff client configurable sysprefs.

To do this, we need to add the a line to:

for packages: /kohaclone/debian/koha-common.cron.monthly and perhaps add something to get the file installed as it's new (our first monthly cronjob for packages :) )

for other installs, there's a cron template in /kohaclone/misc/cronjobs/crontab.example
Comment 1 Paul Poulain 2015-01-15 13:24:16 UTC
I have another idea to ease HEA : add a test in mainpage. If the user has admin rights, ask him about HEA, and/or send the data.
That would almost not slow Koha, and no more need for the cronjob !
Comment 2 Jonathan Druart 2015-01-15 14:04:48 UTC
Paul, the problem is that we want to get data regularly (every month).
We don't want to ask every month (need a test to know when to ask) manual action, don't you think?
Comment 3 Paul Poulain 2015-01-15 14:09:12 UTC
(In reply to Jonathan Druart from comment #2)
> Paul, the problem is that we want to get data regularly (every month).
> We don't want to ask every month (need a test to know when to ask) manual
> action, don't you think?

sorry, i've been unclear:
 * on mainpage.pl :
    * if the sysprefs are not set, display a clear block to say the library must choose
    * if the syspref are set => did we submit more than one month ago ? No=> submit

I agree that, for a library without any admin login regularly, the data will not be submitted regularly. But this situation is an uncommon one I think.
Comment 4 Martin Renvoize 2015-01-19 07:54:28 UTC
I think these are really two different things.  

The addition of the cronjobs to both the crontab.example file and almost more importantly the package templates file would simply mean enabling HEA for reporting statistics would be a simpler task (and make it in reach of 'just a librarian', i.e. clientside only user).

Adding a prompt routine to remind said admin level users to enable the statistics is a seperate piece.. which so long as it was too obtrusive I would probably support.  I'de personally prefer it simply warns say three days after an upgrade to a version supporting HEA, and has the options of enabling HEA, (disabling the warning permanently), Remind me later (suggesting a popup would appear again in another three days), or just disable the popup forever.

Perhaps submit another bug for the above proposal?
Comment 5 Julian FIOL 2015-07-16 13:08:14 UTC Comment hidden (obsolete)
Comment 6 Jonathan Druart 2015-08-19 15:05:10 UTC
Comment on attachment 41024 [details] [review]
Bug 13585 : Add a cronjob which send UsageStats monthly.

Review of attachment 41024 [details] [review]:
-----------------------------------------------------------------

::: debian/koha-common.cron.monthly
@@ +15,5 @@
> +# You should have received a copy of the GNU General Public License
> +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
> +
> +
> +koha-foreach --enabled /usr/share/koha/bin/cronjobs/share_usage_with_koha_community.pl

The problem is that the share_usage_with_koha_community.pl considers it's an error to launch it if the pref is not enabled.
There is a warning message and an exit 1 in this case.

I suppose it's not what we want, the admin will receive an email every month.
Comment 7 Tomás Cohen Arazi 2015-09-01 15:33:37 UTC Comment hidden (obsolete)
Comment 8 Jonathan Druart 2015-09-03 09:50:01 UTC
Comment 6 needs an answer.
Comment 9 Liz Rea 2015-09-03 23:52:57 UTC
Regarding the admin getting an email monthly - I think that might be alright, and here is why: we want to encourage people to contribute their stats. They might install a new version, and not realise that this is a feature they now have. It might take an independent Koha admin several months to "get around" to enabling the sysprefs for "reasons" - in that case the reminder might be nice. An experienced admin will say "that's running a cron, I bet I can remove it from the jobs and this message will go away" which also seems reasonable to me. Instructions on what to do might be nice in the error message, but I don't think the fact that it generates output with the syspref off, in itself, is reason to deny this patch.

A followup that makes the falure output more informative (maybe) would be good.

I see this as very much like the message you get when EnhancedMessagingPreferences is off. As an admin you go "ah right, yeah that's off and I mean it to be" or, if you mean for it to be on "ah right, yeah, I want that on actually!" and you go take care of it.

Liz
Comment 10 Tomás Cohen Arazi 2015-09-04 01:00:42 UTC
(In reply to Jonathan Druart from comment #6)
> Comment on attachment 41024 [details] [review] [review]
> Bug 13585 : Add a cronjob which send UsageStats monthly.
> 
> Review of attachment 41024 [details] [review] [review]:
> -----------------------------------------------------------------
> 
> ::: debian/koha-common.cron.monthly
> @@ +15,5 @@
> > +# You should have received a copy of the GNU General Public License
> > +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
> > +
> > +
> > +koha-foreach --enabled /usr/share/koha/bin/cronjobs/share_usage_with_koha_community.pl
> 
> The problem is that the share_usage_with_koha_community.pl considers it's an
> error to launch it if the pref is not enabled.
> There is a warning message and an exit 1 in this case.

I agree with all of you actually:
- Having a cronjob error email might not be that useful.
- A new bug should be filled. In that case I would propose a --quiet switch and could provide the patch.
- We should at least show a message on the about page about this. And encourage people to check that page regularly on update.
Comment 11 Jonathan Druart 2015-09-04 07:37:40 UTC
Created attachment 42375 [details] [review]
Bug 13585: Add a cronjob which send UsageStats monthly.

This patch introduces entries for monthly running the share_usage_with_koha_community.pl
script to the packages and also the crontab.example file for manual
installs use.

Edit: I fixed the Copyright line

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 12 Tomás Cohen Arazi 2015-09-07 14:29:12 UTC
Patch pushed to master.

Thanks Julian!
Comment 13 Mason James 2016-06-02 06:42:45 UTC
Patch included in 3.22.00