File: t11-pipe-method.sh

package info (click to toggle)
backup-manager 0.7.7-2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 1,284 kB
  • ctags: 202
  • sloc: sh: 3,711; perl: 978; makefile: 220
file content (61 lines) | stat: -rw-r--r-- 1,376 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash

set -e

source testlib.sh
# verbose="true"
# warnings="true"

source confs/base.conf

# taken verbatim from file attached to bug #4
# http://bugzilla.backup-manager.org/cgi-bin/attachment.cgi?id=1&action=view
export BM_REPOSITORY_ROOT="$PWD/repository"
export BM_ARCHIVE_METHOD="pipe"
source $locallib/sanitize.sh
bm_init_env
bm_init_today

BM_PIPE_COMMAND[0]="cat /etc/passwd" 
BM_PIPE_NAME[0]="passwd" 
BM_PIPE_FILETYPE[0]="txt"
BM_PIPE_COMPRESS[0]="gzip"
files[0]="$BM_REPOSITORY_ROOT/$BM_ARCHIVE_PREFIX-passwd.$TODAY.txt.gz"

BM_PIPE_COMMAND[1]="echo 'sukria' ; date " 
BM_PIPE_NAME[1]="sukria" 
BM_PIPE_FILETYPE[1]="txt"
BM_PIPE_COMPRESS[1]="bzip2"
files[1]="$BM_REPOSITORY_ROOT/$BM_ARCHIVE_PREFIX-sukria.$TODAY.txt.bz2"

BM_PIPE_COMMAND[2]="ls -lh /" 
BM_PIPE_NAME[2]="ls-root" 
BM_PIPE_FILETYPE[2]="txt"
BM_PIPE_COMPRESS[2]=""
files[2]="$BM_REPOSITORY_ROOT/$BM_ARCHIVE_PREFIX-ls-root.$TODAY.txt"

# BM_PIPE_COMMAND[3]="/usr/bin/tototot"
# BM_PIPE_NAME[3]="failure"
# BM_PIPE_FILETYPE[3]="txt"
# BM_PIPE_COMPRESS[3]=""

# clean
if [[ -e $PWD/repository ]]; then
    rm -rf $PWD/repository
fi    

# BM actions
create_directories
make_archives

# test of success/failure
for file in $files
do
    if [[ ! -e $file ]]; then
        warning "file $file does not exist"
        rm -rf $BM_ARCHIVE_ROOT
        exit 10
    fi
done
rm -rf $BM_ARCHIVE_ROOT
exit 0