@@ -221,7 +221,7 @@ usage() {
221221 echo " Usage:"
222222 echo " $0 -h | --help this help page"
223223 echo " $0 -d | --dry-run test rsync operations; no data transmitted."
224- echo " $0 no options, perform backup and rsync."
224+ echo " $0 no options, perform backup, rsync or b2 operations ."
225225 echo " "
226226}
227227
@@ -239,6 +239,39 @@ areWeRoot() {
239239 fi
240240}
241241
242+ b2Sync () {
243+ # b2 sync
244+ echo =============================================================
245+ echo -e " Start b2 sync of $gitRakeBackups to bucket $b2Bucketname \n"
246+
247+ if [[ $b2blaze == 0 ]]
248+ then
249+ echo " Backblaze b2 file operations not enabled!"
250+ else
251+
252+ # test for b2 command
253+ if type b2 > /dev/null 2>&1
254+ then
255+ # bucketname set and readable
256+ if [ ! -z $b2Bucketname ]
257+ then
258+ if test -r " $gitRakeBackups " -a -d " $gitRakeBackups "
259+ then
260+ b2 sync --keepDays $b2keepDays --replaceNewer $gitRakeBackups / b2://$b2Bucketname /
261+ else
262+ echo " gitRakeBackups ($gitRakeBackups ) not readable."
263+ fi
264+ else
265+ echo " b2Bucketname not set."
266+ fi
267+ else
268+ echo " b2 command not found!"
269+ fi
270+
271+ fi
272+ echo " "
273+ }
274+
242275confFileExist () {
243276 # read the conffile
244277 if [ -e $confFile -a -r $confFile ]
@@ -267,10 +300,12 @@ case $1 in
267300 if [[ $remoteModule != " " ]]
268301 then
269302 rsyncDaemon_dryrun
303+ b2Sync
270304 # no Daemon so lets see if we are using a special key
271305 else if [ -e $sshKeyPath -a -r $sshKeyPath ] && [[ $sshKeyPath != " " ]]
272306 then
273307 rsyncKey_dryrun
308+ b2Sync
274309 sshQuotaKey
275310 else if [[ $remoteServer != " " ]]
276311 then
@@ -295,15 +330,18 @@ case $1 in
295330 if [[ $remoteModule != " " ]]
296331 then
297332 rsyncDaemon
333+ b2Sync
298334 # no Daemon so lets see if we are using a special key
299335 else if [ -e $sshKeyPath -a -r $sshKeyPath ] && [[ $sshKeyPath != " " ]]
300336 then
301337 rsyncKey
338+ b2Sync
302339 sshQuotaKey
303340 else if [[ $remoteServer != " " ]]
304341 then
305342 # use the defualt
306343 rsyncUp
344+ b2Sync
307345 sshQuota
308346 fi
309347 fi
0 commit comments