Collection of useful scripts for Tine 2.0

On this page I'd like to collect my bash scripts for Linux to administer Tine 2.0 installations.It will grow over the time whenever I'll find the time to put one of my helper scripts online.

Update Script

The following script assumes that your config file is located at /etc/tine20/, which will be put into place by a symbolic link. You have to configure the variables at the beginning, especially the location of your installation and the storage directory for old installations. And you have to tell the script the URL of your installation (to retrieve the current version).

The TRIGGER is a file which tells the webserver to show a site "maintenance work in progress". Additionally you need to specify which user and group the files need to have (USERGROUP) - separated by a dot. If you don't use SELINUX you have to delete the line beginning with chcon. Finally you have to setup mysqldump by a a mysql config file and specify the database to backup. If you don't use a standard php you have to midify this variable, too.

Short usage

Make the script executable by issuing chmod +x /usr/sbin/update-tine20. Then run the script, it asks you for the name of the backup-files (default is preset as current version) while the database dump is named by date/time (useful if you install one version more than once). Secondly it asks for the version to download (as default the latest official version is set). After it downloads the version and makes a database dump, the script will show you the size of the sql-dump (gzip) - after a while you have a pretty good feeling of how big a successful dump is. Until that stage everything is still untouched. If you press CTRL+C you may cancel other wise press enter which will update your version.





PHP=`which php`

# zcat tine20-backup.sql.gz | tail -n +25 | mysql -u tine20 -p -Dtine20 --init-command="SET SESSION FOREIGN_KEY_CHECKS=0;"

if [ ! -d "$BACKUP_DIR" ]; then
 echo "Folder for Installation Backups not found. "


OLDVERSION=$( curl -s "$TINE_URL" | grep X-Tine20-Version | cut -d '"' -f 4 )
read -p "Backup title [$OLDVERSION]: " OLD; echo
if [ "$OLD" == "" ]; then OLD=$OLDVERSION; fi

UPDATE_VERSION=$( curl -s "" | cut -d ',' -f 2 | cut -d '"' -f 4 )
read -p "Tine 2.0 Version (for downloading) [$UPDATE_VERSION]: " VER; echo
if [ "$VER" == "" ]; then VER=$UPDATE_VERSION; fi

touch $TRIGGER

# remove lock and exit
function clean_up {
 rm -f $TRIGGER

if [ ! -f "tine20-allinone_$VER.tar.bz2" ]; then
 wget "$VER/tine20-allinone_$VER.tar.bz2"
 if [ "$?" -ne "0" ]; then
  echo "ERROR: Download failed."

echo "Backup Database ..."

BACKUP_FILE=tine20-`date +"%Y-%m-%dT%H%M%S"`.sql.gz

mysqldump $DUMP_CNF --hex-blob --complete-insert --routines --databases\
 --lock-tables --disable-keys --add-locks $DUMP_DB | gzip > $BACKUP_FILE


read -p "=== UPDATE TINE 2.0 NOW === Press Ctrl+C to abort! === Pess Enter to continue. ===" YESNO; echo

mkdir $OLD
mv $TINE_DIR/* $OLD/

tar -xf $BACKUP_DIR/tine20-allinone_$VER.tar.bz2 -C $TINE_DIR/
rm -f $TINE_DIR/
#cp -a $OLD/ $TINE_DIR/
ln -s /etc/tine20/ $TINE_DIR/


# Update DB

$PHP setup.php --update