As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
#!/bin/bash # Script assumes that Alfresco Database exists and that the user alfresco # has been granted appropriate permissions # i.e. # from mysql prompt: create database alfresco; # grant all on alfresco.* to 'alfresco'@'localhost' identified by 'alfresco' # with grant option; # grant all on alfresco.* to 'alfresco'@'localhost.localdomain' identified by #'alfresco' with grant option; # # Author Erik Billerby, Acando ALF_BASEDIR=/opt/alfresco ALF_DATA_DIRNAME=alf_data ALF_BACKUP_DIR=backup MYSQL_HOME=/opt/alfresco/mysql DB_USERNAME=alfresco DB_PWD=alfresco DB_NAME=alfresco TODAY_STRING=`date +%Y%m%d-%H%M`; MAX_AGE=10 BACKUP_DEL_CMD="rm {}" echo "=== Starting hot backup of Alfresco ===" # First stop Alfresco # echo "=== Stopping Alfresco ===" # $ALF_BASEDIR/alfresco.sh stop # Navigate to the alf_data.dir cd $ALF_BASEDIR/$ALF_DATA_DIRNAME # Create a database dump and store it togheter with the data. $MYSQL_HOME/bin/mysqldump -u$DB_USERNAME -p$DB_PWD $DB_NAME > $DB_NAME.sql sleep 10; cd $ALF_BASEDIR # tar and gzip the data directory and move this to the backup folder, # using a date extension in the name for easy identification # Exclude the lucene indexes, since this is a hot backup procedure. # Lucene indexes will be automatically rolled forward to a correct # state by Alfresco from the backup-lucene-indexes folder. # For this to happen the index.recovery.mode property must be set # to AUTO (repository.properties OR alfresco-global.properties) tar -cvzpP –file=$ALF_BACKUP_DIR/$TODAY_STRING.tar.gz –exclude='lucene-indexes' $ALF_DATA_DIRNAME # delete the mysqldump file from the alf.data_dir echo "Removing temporary mysql backup file $ALF_DATA_DIRNAME/$DB_NAME.sql" rm -f $ALF_DATA_DIRNAME/$DB_NAME.sql # Remove tar files older than number of days specified in $MAX_AGE find $ALF_BACKUP_DIR -mindepth 1 -maxdepth 1 -name "*.tar.gz" -daystart -ctime +$MAX_AGE -exec $BACKUP_DEL_CMD \; echo "=== Backup of Alfresco finished ===" # Command to untar the backup file: # tar -xvf filename.tar # Copy the untared alf_data folder to ALF_BASEDIR: # cp -R backup/alf_data . # Command to restore the database (and yes it should be latin1 # even if the db and tables are set to utf8): # mysql -u$DB_USERNAME -p$DB_PWD –default-character-set=latin1 $DB_NAME < $DB_NAME.sql #echo "=== Starting Alfresco ==="
ALF_BASEDIR=/opt/alfresco # this is my <alfresco_home> ALF_DATA_DIRNAME=/opt/storage/alf_data ALF_BACKUP_DIR=backup # create new folder in <alfresco_home> MYSQL_HOME=/opt/alfresco/mysql DB_USERNAME=alfresco DB_PWD=alfresco DB_NAME=alfresco
… dir.root=/opt/storage/alf_data … db.username=alfresco db.password=alfresco db.name=alfresco …