View | Details | Raw Unified | Return to bug 10532
Collapse All | Expand All

(-)a/debian/docs/koha-dump.xml (-1 / +3 lines)
Lines 23-29 Link Here
23
23
24
  <refsynopsisdiv>
24
  <refsynopsisdiv>
25
    <cmdsynopsis>
25
    <cmdsynopsis>
26
      <command>koha-dump</command> <arg choice="req" rep="norepeat"><replaceable>instancename</replaceable></arg>
26
      <command>koha-dump</command>
27
       <arg><option>--output</option> directory</arg>
28
      <arg choice="req" rep="norepeat"><replaceable>instancename</replaceable></arg>
27
    </cmdsynopsis>
29
    </cmdsynopsis>
28
  </refsynopsisdiv>
30
  </refsynopsisdiv>
29
31
(-)a/debian/scripts/koha-dump (-3 / +35 lines)
Lines 27-50 else Link Here
27
    exit 1
27
    exit 1
28
fi
28
fi
29
29
30
show_help() {
31
    cat <<EOH
32
$0 - performs backup of a koha installations on the system
33
34
Options:
35
    --output:   the directory that the backup files will be placed into.
36
                (default: consults /etc/koha/sites/<instance>/koha-conf.xml)
37
EOH
38
39
}
40
30
# Make sure the files we create are not accessible by anyone else.
41
# Make sure the files we create are not accessible by anyone else.
31
umask 0077
42
umask 0077
32
43
33
# Parse command line.
44
# Parse command line.
34
[ "$#" = 1 ] || die "Usage: $0 instancename"
45
46
backupdir=""
47
48
CMD_LINE=`getopt -o h --long output:,help -n 'koha-dump' -- "$@"`
49
50
if [ $? != 0 ] ; then show_help ; exit 1 ; fi
51
52
eval set -- "$CMD_LINE"
53
while true ; do
54
    case "$1" in
55
        -h|--help)
56
            show_help; exit;;
57
        --output)
58
            backupdir=$2; shift 2 ;;
59
        --) shift ; break ;;
60
        *) echo "Unknown error parsing the command line!" ; exit 1 ;;
61
    esac
62
done
63
64
[ "$#" = 1 ] || die "Usage: $0 [ --output directory ] instancename"
65
35
name="$1"
66
name="$1"
67
68
36
kohaconfig="/etc/koha/sites/$name/koha-conf.xml"
69
kohaconfig="/etc/koha/sites/$name/koha-conf.xml"
37
date="$(date +%Y-%m-%d)"
70
date="$(date +%Y-%m-%d)"
38
71
39
echo "Dumping Koha site $name:"
72
echo "Dumping Koha site $name:"
40
73
41
42
# Dump database.
74
# Dump database.
43
mysqlhost="$( xmlstarlet sel -t -v 'yazgfs/config/hostname' $kohaconfig )"
75
mysqlhost="$( xmlstarlet sel -t -v 'yazgfs/config/hostname' $kohaconfig )"
44
mysqldb="$( xmlstarlet sel -t -v 'yazgfs/config/database' $kohaconfig )"
76
mysqldb="$( xmlstarlet sel -t -v 'yazgfs/config/database' $kohaconfig )"
45
mysqluser="$( xmlstarlet sel -t -v 'yazgfs/config/user' $kohaconfig )"
77
mysqluser="$( xmlstarlet sel -t -v 'yazgfs/config/user' $kohaconfig )"
46
mysqlpass="$( xmlstarlet sel -t -v 'yazgfs/config/pass' $kohaconfig )"
78
mysqlpass="$( xmlstarlet sel -t -v 'yazgfs/config/pass' $kohaconfig )"
47
backupdir="$( xmlstarlet sel -t -v 'yazgfs/config/backupdir' $kohaconfig || true )"
79
[ -z "$backupdir" ] && backupdir="$( xmlstarlet sel -t -v 'yazgfs/config/backupdir' $kohaconfig || true )"
48
[ -z "$backupdir" ] && backupdir="/var/spool/koha/$name"
80
[ -z "$backupdir" ] && backupdir="/var/spool/koha/$name"
49
dbdump="$backupdir/$name-$date.sql.gz"
81
dbdump="$backupdir/$name-$date.sql.gz"
50
echo "* DB to $dbdump"
82
echo "* DB to $dbdump"
(-)a/debian/scripts/koha-run-backups (-2 / +1 lines)
Lines 57-68 done Link Here
57
57
58
for name in $(koha-list --enabled | grep -Fxv demo)
58
for name in $(koha-list --enabled | grep -Fxv demo)
59
do
59
do
60
    koha-dump "$name" > /dev/null
61
    if [ -z "$dirname" ]; then
60
    if [ -z "$dirname" ]; then
62
        backupdir="$( xmlstarlet sel -t -v 'yazgfs/config/backupdir' /etc/koha/sites/$name/koha-conf.xml )";
61
        backupdir="$( xmlstarlet sel -t -v 'yazgfs/config/backupdir' /etc/koha/sites/$name/koha-conf.xml )";
63
    else
62
    else
64
        backupdir="$dirname/$name";
63
        backupdir="$dirname/$name";
65
    fi
64
    fi
65
    koha-dump --output "$backupdir" "$name" > /dev/null
66
66
67
    # Remove old dump files.
67
    # Remove old dump files.
68
    # FIXME: This could probably be replaced by one line of perl.
68
    # FIXME: This could probably be replaced by one line of perl.
69
- 

Return to bug 10532