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

(-)a/debian/scripts/koha-dump (+13 lines)
Lines 47-52 $scriptname [--quiet|-q] [--exclude-indexes] instancename1 [instancename2...] Link Here
47
$scriptname -h|--help
47
$scriptname -h|--help
48
48
49
    --schema-only         Dump only the database schema
49
    --schema-only         Dump only the database schema
50
    --db-only-zip         Dump only the database and also zip the file
50
    --exclude-indexes     Include Zebra indexes on the backup
51
    --exclude-indexes     Include Zebra indexes on 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.
Lines 85-90 dump_instance() Link Here
85
            --user="$mysqluser" --password="$mysqlpass" "$mysqldb" | sed --expression='s/ AUTO_INCREMENT=[0-9]\+//' > "$schemadump"
86
            --user="$mysqluser" --password="$mysqlpass" "$mysqldb" | sed --expression='s/ AUTO_INCREMENT=[0-9]\+//' > "$schemadump"
86
        chown "root:$name-koha" "$schemadump"
87
        chown "root:$name-koha" "$schemadump"
87
        chmod g+r "$schemadump"
88
        chmod g+r "$schemadump"
89
    elif [ "$db_only_zip" = "yes" ]
90
    then 
91
        [ "$quiet" = "no" ] && echo "* DB to $dbdump"
92
        mysqldump $dbflag --host="$mysqlhost" --single-transaction \
93
            --user="$mysqluser" --password="$mysqlpass" "$mysqldb" |
94
            gzip > "$dbdump"
95
        chown "root:$name-koha" "$dbdump"
96
        chmod g+r "$dbdump" 
88
    else
97
    else
89
        [ "$quiet" = "no" ] && echo "* DB to $dbdump"
98
        [ "$quiet" = "no" ] && echo "* DB to $dbdump"
90
        mysqldump $dbflag --host="$mysqlhost" --single-transaction \
99
        mysqldump $dbflag --host="$mysqlhost" --single-transaction \
Lines 144-149 quiet="no" Link Here
144
exclude_indexes="no"
153
exclude_indexes="no"
145
without_db_name="no"
154
without_db_name="no"
146
schema_only="no"
155
schema_only="no"
156
db_only_zip="no"
147
157
148
while [ $# -gt 0 ]; do
158
while [ $# -gt 0 ]; do
149
159
Lines 151-156 while [ $# -gt 0 ]; do Link Here
151
        --schema-only)
161
        --schema-only)
152
            schema_only="yes"
162
            schema_only="yes"
153
            shift ;;
163
            shift ;;
164
        --db-only-zip)
165
            db_only_zip="yes"
166
            shift ;;
154
        --exclude-indexes)
167
        --exclude-indexes)
155
            exclude_indexes="yes"
168
            exclude_indexes="yes"
156
            shift ;;
169
            shift ;;
(-)a/debian/scripts/koha-run-backups (-6 / +7 lines)
Lines 34-46 Options: Link Here
34
                       (default: 2)
34
                       (default: 2)
35
    --exclude-indexes  Exclude Zebra indexes from the backups (default: false)
35
    --exclude-indexes  Exclude Zebra indexes from the backups (default: false)
36
36
37
    --db-only-zip      Only include the Database dump in backup (default: false)
38
37
Note: backups produced using this tool can be restored using \`koha-restore'.
39
Note: backups produced using this tool can be restored using \`koha-restore'.
38
EOH
40
EOH
39
}
41
}
40
42
41
exclude_indexes=""
43
exclude_indexes=""
44
db_only_zip=""
42
45
43
CMD_LINE=`getopt -o h --long days:,output:,help,exclude-indexes -n 'koha-run-backups' -- "$@"`
46
CMD_LINE=`getopt -o h --long days:,output:,help,exclude-indexes,db-only-zip -n 'koha-run-backups' -- "$@"`
44
47
45
if [ $? != 0 ] ; then show_help ; exit 1 ; fi
48
if [ $? != 0 ] ; then show_help ; exit 1 ; fi
46
49
Lines 55-75 while true ; do Link Here
55
            dirname=$2; shift 2 ;;
58
            dirname=$2; shift 2 ;;
56
        --exclude-indexes)
59
        --exclude-indexes)
57
            exclude_indexes='--exclude-indexes'; shift ;;
60
            exclude_indexes='--exclude-indexes'; shift ;;
61
        --db-only-zip)
62
            db_only_zip='--db-only-zip'; shift ;;
58
        --) shift ; break ;;
63
        --) shift ; break ;;
59
        *) echo "Unknown error parsing the command line!" ; exit 1 ;;
64
        *) echo "Unknown error parsing the command line!" ; exit 1 ;;
60
    esac
65
    esac
61
done
66
done
62
63
if ! test $days -gt 0 ; then
67
if ! test $days -gt 0 ; then
64
    echo "Parameter --days must be an integer greater than 0"
68
    echo "Parameter --days must be an integer greater than 0"
65
    exit 1
69
    exit 1
66
fi
70
fi
67
68
for name in $(koha-list --enabled | grep -Fxv demo)
71
for name in $(koha-list --enabled | grep -Fxv demo)
69
do
72
do
70
    if koha-dump ${exclude_indexes} "$name" > /dev/null; then
73
    if koha-dump ${exclude_indexes} ${db_only_zip} "$name" > /dev/null; then
71
        # Only delete old backups if dump script return success.
74
        # Only delete old backups if dump script return success.
72
73
        if [ -z "$dirname" ]; then
75
        if [ -z "$dirname" ]; then
74
            backupdir="$( xmlstarlet sel -t -v 'yazgfs/config/backupdir' /etc/koha/sites/$name/koha-conf.xml )";
76
            backupdir="$( xmlstarlet sel -t -v 'yazgfs/config/backupdir' /etc/koha/sites/$name/koha-conf.xml )";
75
        else
77
        else
76
- 

Return to bug 36311