diff options
author | robocoder <anthon.pang@gmail.com> | 2009-12-10 06:17:18 +0300 |
---|---|---|
committer | robocoder <anthon.pang@gmail.com> | 2009-12-10 06:17:18 +0300 |
commit | 7534145fe0413e1a7b05c7fc693e6902e9dcb50c (patch) | |
tree | 24ed9e39f2dafd170e3af0cd161afcac76b7d411 /misc/cron/archive.sh | |
parent | 992df963e03f819c49779e98827723d871264823 (diff) |
handle case where php5 doesn't exist and script invoked with -e parameter
git-svn-id: http://dev.piwik.org/svn/trunk@1659 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'misc/cron/archive.sh')
-rw-r--r-- | misc/cron/archive.sh | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/misc/cron/archive.sh b/misc/cron/archive.sh index 704068864d..bfd43fd3e4 100644 --- a/misc/cron/archive.sh +++ b/misc/cron/archive.sh @@ -19,16 +19,22 @@ # time_before_archive_considered_outdated = 3600 # enable_browser_archiving_triggering = false -PHP_BIN=`which php5 2>/dev/null` +for TEST_PHP_BIN in php5 php; do + if which $TEST_PHP_BIN >/dev/null 2>/dev/null; then + PHP_BIN=`which $TEST_PHP_BIN` + break + fi +done if test -z $PHP_BIN; then - PHP_BIN=`which php` + echo "php binary not found. Make sure php5 or php exists in PATH." + exit 1 fi act_path() { - local pathname="$1" - readlink -f "$pathname" 2>/dev/null || \ - realpath "$pathname" 2>/dev/null || \ - type -P "$pathname" 2>/dev/null + local pathname="$1" + readlink -f "$pathname" 2>/dev/null || \ + realpath "$pathname" 2>/dev/null || \ + type -P "$pathname" 2>/dev/null } ARCHIVE=`act_path ${0}` |