cancel
Showing results for 
Search instead for 
Did you mean: 

Linux script for backup

xarkam
Champ in-the-making
Champ in-the-making
hello,

i'm working on a script for backuping Alfresco and i subit this on your comments and ideas for improvement
#!/bin/bash
Days=`date +%Y%m%d-%H%M%S`;
Alfresco_root="/opt/alfresco3";
Alfresco_repository="$Alfresco_root/alfresco_repository/";
Alfresco_indexes="$Alfresco_root/alfresco_indexes/";
Alfresco_backup_dir="/opt/Alfresco_Backup_$Days";
user_mysql="alfresco";
user_password="alfresco";
alfresco_db="alfresco";

echo "=== Stoping Alfresco ==="
echo $Alfresco_root/alfresco.sh stop
echo sleep 10;
echo "=== Making the directory backup $Alfresco_backup_dir ==="
echo mkdir $Alfresco_backup_dir;
echo cd $Alfresco_backup_dir;
echo "=== Make Mysql Backup ==="
echo mysqldump –user=$user_mysql –password=$user_password $alfresco_db -q –single-transaction -R -t –disable-keys –complete-insert| bzip2 > $alfresco_db_$Days.sql.backup

echo "=== Creating Aflresco Repository Backup ==="
echo tar cjfv alfresco_repository_$Days.tar.bz2 $Alfresco_repository
echo "=== Creating Alfresco Indexes Backup ==="
echo tar cjfv alfresco_indexes_$Days.tar.bz2 $Alfresco_indexes
echo "=== Restating Alfresco ==="
echo $Alfresco_root/alfresco.sh start
the echo command befor the real commands it's for testing
4 REPLIES 4

xarkam
Champ in-the-making
Champ in-the-making
Yes, i'm work to one procedure to verify the presence of alfresco if is not correctly stopped.

mahlzeit
Champ in-the-making
Champ in-the-making
Hallo,

alf.backup.sh-0.02 publish for testing.
thank you for your quick response.

Mahlzeit Heiko

[1] http://www2.fh-lausitz.de/launic/comp/misc/alfresco/alf.backup.sh-0.02-120106


$ alf.backup.sh -verbose 0 help
  alf.backup.sh-0.02-120106
  features:
   - backup with timestamp
   - backup hot/cold
   - backup DB/FS
   - force backupbeforerestore
   - check df
   - write log
   - save env (meta: alfver, etc.)
   - can running as nonroot
  usage:
        alf.backup.sh [options] (backup|restore|help|list)
  options:
    -date yymmdd[HHMM]          timestamp  (1201061001)
    -verbose 0|1                print verbose (0)
                                "-verbose 1 help" print all variables
    -dobackupdb 0|1             mysqldump/restore (1)
    -dobackupfs 0|1             backup data to backupfiledata (1)
    -cfgfile file               read config, prefered  (/etc/alf.backup.cfg)
  ex:
    backup cron:
     01 01 * * * /usr/local/sbin/alf.backup.sh -verbose 0 backup
      - backup with timestamp
     01 01 * * * /usr/local/sbin/alf.backup.cron.sh backup
      - rolling backup: create new, remove old
      - s. 110922.alf.backup
    restore:
      /usr/local/sbin/alf.backup.sh list | grep env
      /usr/local/sbin/alf.backup.sh -date 1012241212 restore
    backup db to diag:
     /usr/local/sbin/alf.backup.sh -date 120106diag -dobackupfs 0 -dobackupdb 1 backup
     zcat  alf.120106diag.sql.gz | egrep "$regex"

nickbsd
Champ in-the-making
Champ in-the-making
How do I use this script? I've downloaded the script and made it executable but it doesn't spit out any output?

mahlzeit
Champ in-the-making
Champ in-the-making
How do I use this script? I've downloaded the script and made it executable but it doesn't spit out any output?
no output if verbose=0


- get backupdir and list files
  $ alf.backup.sh -verbose 1 help | grep backupdir
  $ ls -l $backupdir

- if files not found, then exec following commands and post output:
  $ alf.backup.sh -verbose 1 backup
  $ alf.backup.sh -verbose 1 list


Mahlzeit Heiko