@anonymous-matomo-user opened this Issue on September 13th 2010

The archive.sh script is either broken or simply incompatible with Freebsd servers.

Attempting to run it as the root user as 'sh archive.sh' leads to:

Starting Piwik reports archiving...

Reports archiving finished.
Starting Scheduled tasks...

Error: You can't access this resource as it requires a 'superuser' access.Finished Scheduled tasks.

Running it via cron according to the directions listed at the setup-auto-archiving/ page leads to the following.

/usr/local/www/piwik/misc/cron/archive.sh: not found

That happens because bash is not installed by default on Freebsd servers. Further more the script references a non standard location of bash if it is installed. It should reference /usr/local/bin/bash. Installing and fixing the bash path and running it via cron leads to the following error:

shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied

I figured I'd try here first in the hope that I'm making a mistake or missing something before I start tearing it apart in a attempt to make it work.

There is also a forum reference to the issue. I'll link to it once the forum's are back on line. They appear to be down right now.
Keywords: freebsd

@robocoder commented on September 13th 2010 Contributor

Using #!/bin/bash in the script is a best guess. Loading up the shell depends on the scripting environment -- it happens before script execution, so there's nothing we can do. You can use:

/usr/local/bin/bash /path/to/script

The shell-init error means the cron job is running as a user who doesn't have read access to the shell script.

@hansfn commented on January 4th 2011

Hi, sorry for re-opening this issue, but since the fix is so easy I hope that you can reconsider and make archive.sh use /bin/sh in stead of /bin/bash.

The point is that archive.sh doesn't use any bash specific features, and requiring people to install bash when sh will do is kind of, well, unnecessary.

Thx for listening. Now I'll go and update the Norwegian Bokml translation ;-)

@hansfn commented on January 4th 2011

PS! I wasn't allowed to reopen it (no permission to change fields), so I had to leave it closed. Hopefully you'll notice it anyway.

@mattab commented on January 4th 2011 Member

if we change to bin/sh maybe it will break for some existing users?

@hansfn commented on January 5th 2011

No, it won't break. /bin/sh is actually a standard (POSIX) for all Unix/Linux OS-es - quote from http://en.wikipedia.org/wiki/Shebang_(Unix):

"POSIX requires that /bin/sh is a shell capable of a syntax similar to the Bourne shell."

I would have pointed to the actual POSIX standard itself, but it's behind a pay wall.

@mattab commented on January 5th 2011 Member

(In [3639]) Fixes #1698 - I assume the -e parameter is still valid?

@hansfn commented on January 5th 2011

Yes, the -e parameter means the same for sh and bash. (And to be sure I have tested ;-)


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

note on this:
the issue is not only in referencing sh or bash, but more importantly to avoid using special bash features that will not work in sh

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