Updating OTRS made easy - USE AT OWN RISK

Dont create your support topics here! No new topics with questions allowed!

Moderator: crythias

Forum rules
Dont create your support topics here! No new topics with questions allowed!
Post Reply
iztok
Znuny newbie
Posts: 83
Joined: 06 Jan 2011, 14:28
Znuny Version: 3

Updating OTRS made easy - USE AT OWN RISK

Post by iztok »

Hello,

below is the well-tested script I wrote for upgrading OTRS to new versions (3.0.x) on Linux with Apache2 / MySQL

Change variables according to your own enviroment :)

Code: Select all

#!/bin/sh
service cron stop
service apache2 stop
cp -R /opt/otrs /opt/otrs.backup
mysqldump -h localhost -u SQL_USERNAME -pSQL_PASSWORD DATABASENAME | bzip2 -c > otrs.sql.bz2
mv otrs.sql.bz2 /opt/otrs.backup/
tar -xzf otrs-3.0.x.tar.gz
cp -R otrs-3.0.x/* /opt/otrs
cp /opt/otrs.backup/Kernel/Config.pm /opt/otrs/Kernel/Config.pm
cp /opt/otrs.backup/Kernel/Config/Files/ZZZAuto.pm /opt/otrs/Kernel/Config/Files/ZZZAuto.pm
cp /opt/otrs.backup/Kernel/Config/GenericAgent.pm /opt/otrs/Kernel/Config/GenericAgent.pm
cp /opt/otrs.backup/var/httpd/htdocs/skins/Agent/default/img/logo_bg.png /opt/otrs/var/httpd/htdocs/skins/Agent/default/img/log$
/opt/otrs/bin/otrs.SetPermissions.pl --otrs-user=otrs --otrs-group=www-data --web-user=www-data --web-group=www-data /opt/otrs
/opt/otrs/bin/otrs.RebuildConfig.pl
/opt/otrs/bin/otrs.DeleteCache.pl
service cron start
service apache2 start
Wolfgangf
Znuny ninja
Posts: 1029
Joined: 13 Apr 2009, 12:26
Znuny Version: 6.0.13
Real Name: Wolfgang Fürtbauer
Company: PBS Logitek GmbH
Location: Pinsdorf

Re: Updating OTRS made easy - USE AT OWN RISK

Post by Wolfgangf »

Hi!

:) looking nice

I would want to add at least
bin/otrs.RebuildConfig.pl
bin/otrs.DeleteCache.pl

at the end and probably the db-update scripts
Produktiv:
OTRS 6.0.13/ ITSM 6.0.13
OS: SUSE Linux (SLES 12, Leap), MySql 5.5.x, 5.6.x
Windows 2012 AD Integration (agents and customers), Nagios integration (incidents, CMDB), Survey, TimeAccounting
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Updating OTRS made easy - USE AT OWN RISK

Post by crythias »

I'd throw in the use of git for backup, if you want...
http://forums.otrs.org/viewtopic.php?f=53&t=8204
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
liuk001
Znuny newbie
Posts: 7
Joined: 09 Sep 2011, 16:48
Znuny Version: 3.0.10
Real Name: Luca Maranzano

Re: Updating OTRS made easy - USE AT OWN RISK

Post by liuk001 »

Useful script really!

IMHO it is missing the restore of the crontab files, something like:

cp /opt/otrs.backup/var/cron/* /opt/otrs/var/cron/

otherwise the new otrs will have an empty crontab (it happened to me on the last upgrade :-)

Just my 2c.
Cheers,
Luca
Araska
Znuny newbie
Posts: 8
Joined: 18 Jul 2011, 05:51
Znuny Version: 3.0.6
Real Name: Nathan Murphy
Company: The Frame Group

Re: Updating OTRS made easy - USE AT OWN RISK

Post by Araska »

Hi,

My collegue Dmitry (excelent linux administrator) wrote the following script to update OTRS in a Debian environment.

To invoke the script, SSH as root and type ./upgrade-otrs.sh <version>

In order for it to work though, you need to have your OTRS file structure like this:
(in /opt/)

lrwxrwxrwx 1 root root 16 Sep 23 13:35 otrs -> /opt/otrs-3.0.10
drwxr-xr-x 8 root root 4096 Jul 29 22:57 otrs-3.0.10

Code: Select all

#!/bin/bash

# version: 20110920
# tested with 3.0.6 to 3.0.10 upgrade
# invoke as root with version number as argument
# current version is http://ftp.otrs.org/pub/otrs/otrs-3.0.10.tar.bz2

VER="$1"
[ -z "$VER" ] && echo "Please invoke with desired version as argument" && exit 1


[ -e "otrs-$VER.tar.bz2" ]  ||  wget "http://ftp.otrs.org/pub/otrs/otrs-$VER.tar.bz2"

echo "Extracting version $VER"
tar xjvf "otrs-$1.tar.bz2" --directory /opt


echo "Stopping services"
/etc/init.d/cron stop
/etc/init.d/exim4 stop
/etc/init.d/apache2 stop


echo "taking backup of files in /opt/otrs"
#tar cjvf otrs-backup-$(date +%Y%m%d).tar.bz2  /opt/otrs/*

echo "taking backup of MySQL database (otrs)"
#mysqldump -uroot -pp@ssw0rd --routines --single-transaction otrs | bzip2 -9 -c > otrs-db-$(date +%Y%m%d).mysql.tar.bz2


echo prepare destination
OLDVER="/opt/$(readlink /opt/otrs)"
NEWVER="/opt/otrs-$VER"

cp "$OLDVER/Kernel/Config.pm"                   "$NEWVER/Kernel/Config.pm"
cp "$OLDVER/Kernel/Config/GenericAgent.pm"      "$NEWVER/Kernel/Config/GenericAgent.pm"
cp "$OLDVER/Kernel/Config/Files/ZZZAuto.pm"     "$NEWVER/Kernel/Config/Files/ZZZAuto.pm"

rm /opt/otrs
cd /opt && ln -s $NEWVER otrs
cd /opt/otrs/


# step pre-7
# set permissions which step 7 do not set
chown -R www-data:www-data "$NEWVER"
#chown -R www-data:www-data "$NEWVER//Kernel/Config/Files"
#chown www-data:www-data "$NEWVER/Kernel/Config/Files/ZZZAuto.pm"
#chown otrs:www-data "$NEWVER/Kernel/Config/GenericAgent.pm"

# step 7
bin/otrs.SetPermissions.pl --otrs-user=otrs --web-user=www-data --otrs-group=www-data --web-group=www-data /opt/otrs


## step 8 : not needed for 3.0.* to 3.0.* updates
##cat scripts/DBUpdate-to-3.0.mysql.sql | mysql -pp@ssw0rd -f -u root otrs

## step 9 : not needed for 3.0.* to 3.0.* updates
##sudo -uotrs scripts/DBUpdate-to-3.0.pl

## step 10 : not needed for 3.0.* to 3.0.* updates
##cat scripts/DBUpdate-to-3.0-post.mysql.sql | mysql -pp@ssw0rd -f -u root otrs


# step 11
#bin/otrs.RebuildConfig.pl
bin/otrs.DeleteCache.pl

# step 12
/etc/init.d/cron start
/etc/init.d/exim4 start
/etc/init.d/apache2 start


echo well done!

OTRS 3.0 on Debian Linux with MySQL database connected to an Active Directory for Customers.
KimmoJ
Znuny newbie
Posts: 47
Joined: 15 Sep 2011, 09:32
Znuny Version: 6.0.22
Real Name: Kimmo Jaskari
Company: Transmar Ab

Re: Updating OTRS made easy - USE AT OWN RISK

Post by KimmoJ »

Thanks for these scripts. I'm not going to use them. :) However, they're excellent to use as a step by step reference for what needs to be done (about to tackle an upgrade from 3.0.6 to 3.0.11, haven't upgraded the system before and figured I'd pop in here and check for a recommended process.) Much appreciated.
Post Reply