Quantcast
Channel: bigbabou in bloxtacy » snippet
Viewing all articles
Browse latest Browse all 9

piwik in version 0.5.2 + update script

$
0
0

while waiting for an almost ten gigabytes large piwik database to be updated, i’m just writing down that piwik got a new release yesterday.

upgrading piwik is easy. i pushed all steps to upgrade it on a linux (debian) server in a small shell script you may find useful.

simple update script for piwik

#!/bin/bash
# auto-update piwik
# @author bigbabou <bigbabou@web.de>
#

# where my current piwik resides
installdir=/var/www/

# where the ugly stuff should be made
workingdir=/home/bigbabou/

# used for copying the new piwik source
piwikdir=/home/bigbabou/piwik/*
logfile=updatepiwik.log

# where the new piwik can be downloaded
piwikurl=http://piwik.org/latest.zip

cd ${workingdir}

# check if update is necessary
wget -N -o${logfile} ${piwikurl}

# overwrite silently
unzip -q -o latest.zip

# tidy up old piwik dir
cd ${installdir}

rm -rf core js lang libs misc plugins tests themes tmp
rm index.php piwik.js piwik.php robots.txt README

# safe global.ini before updating
chown root config/global.ini.backup_by_script
chmod 770 config/global.ini.backup_by_script

echo 'copying new files'
cp -r ${piwikdir} .
chown -R www-data *
chgrp -R www-data *
ls --color=auto -lA ${installdir}

# make nightly precaching exectuable
chmod 770 ${installdir}'misc/cron/archive.sh'

# clean up stuff
cd ${workingdir}
rm latest.zip
rm How\ to\ install\ Piwik.html
rm -rf piwik

echo 'piwik update successful. have a nice day!'

## update db on shell
php ${installdir}index.php

echo ' - update script end -'
exit 0

two lines could be added for convenience

chmod 777 ${installdir}tmp/cache
chmod 777 ${installdir}tmp/templates_c

Viewing all articles
Browse latest Browse all 9

Trending Articles