@anonymous-matomo-user opened this Issue on January 9th 2011

It would be nice to have the possibility to configure the path and name of the php executable to bypass the search mechanism.

@mattab commented on January 9th 2011 Member

What is your php path? why is not picked up by archive.sh?

@anonymous-matomo-user commented on January 9th 2011

On my hosters server there are at least two versions of php installed. At some point (I don't know why) it started to give a segmentation fault with the older version. I had to change the script to have the version 5.3 started. But with the next update of piwik I will have to change the script again, until the hoster solved the problem with the segmentation fault.

So the php path is picked up by archive.sh but I would like to bypass the mechanism to set the path myself without changing archive.sh.

@mattab commented on January 9th 2011 Member

OK makes sense, if you can provide a patch it's more likely we will do the change :)

@anonymous-matomo-user commented on January 9th 2011

I can try...

should it use a parameter for the script or a configuration file to provide the optional path? what would make sense in the piwik architecture?

@robocoder commented on January 9th 2011 Contributor

This has come up before, and I don't think it requires a change to the script, since it's environment specific.

The FAQ has:

MAILTO="youremail<a class='mention' href='https://github.com/example'>@example</a>.com"
5 * * * * www-data /path/to/piwik/misc/cron/archive.sh > /dev/null

Can you add a PATH= line to your crontab, so it looks like:

PATH=/path_to_working_php_dir/:$PATH
MAILTO="youremail<a class='mention' href='https://github.com/example'>@example</a>.com"
5 * * * * www-data /path/to/piwik/misc/cron/archive.sh > /dev/null
@anonymous-matomo-user commented on January 9th 2011

As the hosting provider allows only to create cron jobs through a web gui I can't add the PATH= line to the crontab.

But with your input I found another solution. I created a wrapper around archive.sh and called it archive-ex.sh. The cron job calls now my new script. Inside this script I set the path and call then the archive.sh script:

#!/bin/sh -e

# Description
# This script is a wrapper for the archive.sh script to configure the path to the php
# executable. The script adapts the path and calls then archive.sh

PATH='/path/to/php':$PATH

/path/to/piwik/misc/cron/archive.sh

With this solution I don't need this feature anymore. The ticket can be closed in my oppinion.

Thanks for your support!

@robocoder commented on January 9th 2011 Contributor

Ok.

p.s. some environments may allow something like this one-liner:

5 * * * * PATH=/path/to/php:$PATH /path/to/piwik/misc/cron/archive.sh > /dev/null

Similarly, if your host didn't have /bin/sh:

5 * * * * PATH=/path/to/php:$PATH /path/to/shell /path/to/piwik/misc/cron/archive.sh > /dev/null
@robocoder commented on January 9th 2011 Contributor

(Matt: why does the FAQ example have "www-data" in it?)

@anonymous-matomo-user commented on July 7th 2011

Replying to vipsoft:

(Matt: why does the FAQ example have "www-data" in it?)

there are two different types of cronab files:

the system crontab, in /etc/crontab (and includes in /etc/cron.d/). that has a username field to specify the user to run the job as, and user crontabs, which don't haev it (because jobs always run as the owner of the crontab).

www-data is the name of the user the webserver runs as on most distributions... and it's best to run the cronjob as the same user.

the example without username is for putting directly into that user's crontab (which is also what your web interface most likely uses)

This Issue was closed on July 7th 2011
Powered by GitHub Issue Mirror