Skip to content

Loading… compatible with Freebsd (using /bin/sh instead of /bin/bash) #1698

anonymous-piwik-user opened this Issue · 8 comments

4 participants


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

Attempting to run it as the root user as '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/ 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


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.


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

The point is that 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 ;-)


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.

Piwik Open Source Analytics member

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


No, it won't break. /bin/sh is actually a standard (POSIX) for all Unix/Linux OS-es - quote from

"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.

Piwik Open Source Analytics member

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


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



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

@anonymous-piwik-user anonymous-piwik-user added this to the Piwik 1.1 milestone
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.