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

(-)a/debian/scripts/koha-dump (-3 / +21 lines)
Lines 2-18 Link Here
2
#
2
#
3
# koha-dump: dump all contents and configs for a Koha site
3
# koha-dump: dump all contents and configs for a Koha site
4
# Copyright 2010  Catalyst IT, Ltd
4
# Copyright 2010  Catalyst IT, Ltd
5
# 
5
#
6
# This program is free software: you can redistribute it and/or modify
6
# This program is free software: you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation, either version 3 of the License, or
8
# the Free Software Foundation, either version 3 of the License, or
9
# (at your option) any later version.
9
# (at your option) any later version.
10
# 
10
#
11
# This program is distributed in the hope that it will be useful,
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
# GNU General Public License for more details.
14
# GNU General Public License for more details.
15
# 
15
#
16
# You should have received a copy of the GNU General Public License
16
# You should have received a copy of the GNU General Public License
17
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
18
Lines 48-53 $scriptname -h|--help Link Here
48
48
49
    --schema-only         Dump only the database schema
49
    --schema-only         Dump only the database schema
50
    --exclude-indexes     Include Zebra indexes on the backup
50
    --exclude-indexes     Include Zebra indexes on the backup
51
    --exclude-logs        Exclude /var/log/koha/name from the backup
51
    --uploaded_files      Include uploaded files.
52
    --uploaded_files      Include uploaded files.
52
    --uploaded_temp_files Include temporary uploaded files.
53
    --uploaded_temp_files Include temporary uploaded files.
53
    --quiet|-q            Make the script avoid printing to STDOUT
54
    --quiet|-q            Make the script avoid printing to STDOUT
Lines 123-128 dump_instance() Link Here
123
        output="$output to $metadump"
124
        output="$output to $metadump"
124
        [ "$quiet" = "no" ] && echo "$output"
125
        [ "$quiet" = "no" ] && echo "$output"
125
126
127
        if [ "$exclude_logs" = "yes" ]; then
128
        tar -czf "$metadump" -C / $excludes \
129
            "etc/koha/sites/$name" \
130
            "etc/apache2/sites-available/$instancefile" \
131
            "etc/apache2/sites-enabled/$instancefile" \
132
            "var/lib/koha/$name" \
133
            $uploaded_files_dir \
134
            $uploaded_temp_files_dir
135
136
        chown "root:$name-koha" "$metadump"
137
        chmod g+r "$metadump"
138
        else
126
        tar -czf "$metadump" -C / $excludes \
139
        tar -czf "$metadump" -C / $excludes \
127
            "etc/koha/sites/$name" \
140
            "etc/koha/sites/$name" \
128
            "etc/apache2/sites-available/$instancefile" \
141
            "etc/apache2/sites-available/$instancefile" \
Lines 134-139 dump_instance() Link Here
134
147
135
        chown "root:$name-koha" "$metadump"
148
        chown "root:$name-koha" "$metadump"
136
        chmod g+r "$metadump"
149
        chmod g+r "$metadump"
150
      fi
137
151
138
        [ "$quiet" = "no" ] && echo "Done."
152
        [ "$quiet" = "no" ] && echo "Done."
139
    fi
153
    fi
Lines 144-149 quiet="no" Link Here
144
exclude_indexes="no"
158
exclude_indexes="no"
145
without_db_name="no"
159
without_db_name="no"
146
schema_only="no"
160
schema_only="no"
161
exclude_logs="no"
147
162
148
while [ $# -gt 0 ]; do
163
while [ $# -gt 0 ]; do
149
164
Lines 154-159 while [ $# -gt 0 ]; do Link Here
154
        --exclude-indexes)
169
        --exclude-indexes)
155
            exclude_indexes="yes"
170
            exclude_indexes="yes"
156
            shift ;;
171
            shift ;;
172
        --exclude-logs)
173
            exclude_logs="yes"
174
            shift ;;
157
        --without-db-name)
175
        --without-db-name)
158
            without_db_name="yes"
176
            without_db_name="yes"
159
            shift ;;
177
            shift ;;
(-)a/debian/scripts/koha-run-backups (-7 / +7 lines)
Lines 1-16 Link Here
1
#!/bin/sh
1
#!/bin/sh
2
# Copyright 2010-2011  Catalyst IT, Ltd
2
# Copyright 2010-2011  Catalyst IT, Ltd
3
# 
3
#
4
# This program is free software: you can redistribute it and/or modify
4
# This program is free software: you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation, either version 3 of the License, or
6
# the Free Software Foundation, either version 3 of the License, or
7
# (at your option) any later version.
7
# (at your option) any later version.
8
# 
8
#
9
# This program is distributed in the hope that it will be useful,
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
# GNU General Public License for more details.
12
# GNU General Public License for more details.
13
# 
13
#
14
# You should have received a copy of the GNU General Public License
14
# You should have received a copy of the GNU General Public License
15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
16
Lines 40-46 EOH Link Here
40
40
41
exclude_indexes=""
41
exclude_indexes=""
42
42
43
CMD_LINE=`getopt -o h --long days:,output:,help,exclude-indexes -n 'koha-run-backups' -- "$@"`
43
CMD_LINE=`getopt -o h --long days:,output:,help,exclude-indexes,exclude-logs -n 'koha-run-backups' -- "$@"`
44
44
45
if [ $? != 0 ] ; then show_help ; exit 1 ; fi
45
if [ $? != 0 ] ; then show_help ; exit 1 ; fi
46
46
Lines 55-60 while true ; do Link Here
55
            dirname=$2; shift 2 ;;
55
            dirname=$2; shift 2 ;;
56
        --exclude-indexes)
56
        --exclude-indexes)
57
            exclude_indexes='--exclude-indexes'; shift ;;
57
            exclude_indexes='--exclude-indexes'; shift ;;
58
        --exclude-logs)
59
            exclude_logs='--exclude-logs'; shift ;;
58
        --) shift ; break ;;
60
        --) shift ; break ;;
59
        *) echo "Unknown error parsing the command line!" ; exit 1 ;;
61
        *) echo "Unknown error parsing the command line!" ; exit 1 ;;
60
    esac
62
    esac
Lines 67-73 fi Link Here
67
69
68
for name in $(koha-list --enabled | grep -Fxv demo)
70
for name in $(koha-list --enabled | grep -Fxv demo)
69
do
71
do
70
    if koha-dump ${exclude_indexes} "$name" > /dev/null; then
72
    if koha-dump ${exclude_indexes} ${exclude_logs} "$name" > /dev/null; then
71
        # Only delete old backups if dump script return success.
73
        # Only delete old backups if dump script return success.
72
74
73
        if [ -z "$dirname" ]; then
75
        if [ -z "$dirname" ]; then
Lines 79-82 do Link Here
79
        find $backupdir -maxdepth 1 \( -mtime +$days -or -mtime $days \) -name $name-'[1-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9].???'.gz  \( -name \*.sql.gz -or -name \*.tar.gz \) -print0 | xargs -0 -r rm
81
        find $backupdir -maxdepth 1 \( -mtime +$days -or -mtime $days \) -name $name-'[1-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9].???'.gz  \( -name \*.sql.gz -or -name \*.tar.gz \) -print0 | xargs -0 -r rm
80
    fi
82
    fi
81
done
83
done
82
83
- 

Return to bug 36325