obnam.conf

[config]
repository = /media/boudiccas/backup/obnam-home/
root = /home/boudiccas/
exclude = ~/.thumbnails$, .iso$
exclude-caches = false
keep = 8h,14d,10w,12m
log = /home/boudiccas/cron/obnam/obnamhome.txt
log-level = info
log-keep = 5
log-max = 50 mb
log-mode = 0600

notify-send

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
#!/bin/bash

notify-send "Starting main backup..."

obnam backup

if [ "$?" -ne 0 ]; then
  notify-send "Unable to finish main backup."
  exit 1
else
  notify-send "Finished main backup."

  echo -e "Sending Backup report : Backup of obnam-home completed"

fi

obnam today

 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
#!/bin/bash -e
#: Title            : obnam-today
#: Date             : July 2013
#: Author           : Sharon Kimble
#: Version          : 3.0
#: Description      : to give a complete dated list of all of obnams savings, run from $ROOT cron
#: Options          : 3, all listed in Variables
#: License          : GNU GPL 3.0 or later
####################################################
# Changelog - 22-7-13
# added sudo to ensure that root can backup users files and still keep users permissions
# 19-8-13
# added mailto on successful completion
####################################################
# Variables
NUM="6"     #number of backup files to keep
LOGFILE="/home/boudiccas/logs/obnam-ls.txt"
FILE="/home/boudiccas/bin/obnam-today.$$"
####################################################

# Change into new directory
cd /home/boudiccas/cron/obnam/

chown boudiccas: /home/boudiccas/cron/obnam-ls.txt

# Generate new file and save it
sudo -u boudiccas obnam --config=/etc/obnam.conf ls>"obnamhome-ls-$(date +%Y-%m-%d).txt"

sudo -u boudiccas obnam --config=/etc/obnam-back4.conf ls>"obnamback4-ls-$(date +%Y-%m-%d).txt"

obnam --config=/etc/obnametc.conf ls>"obnametc-ls-$(date +%Y-%m-%d).txt"

obnam --config=/etc/obnamvar.conf ls>"obnamvar-ls-$(date +%Y-%m-%d).txt"

# Delete old backups!
find /home/boudiccas/cron/obnam -type f -mtime +$NUM -name 'obnamhome-ls-*.txt' -exec rm -v {} +>>$LOGFILE 2>&1

find /home/boudiccas/cron/obnam -type f -mtime +$NUM -name 'obnamback4-ls-*.txt' -exec rm -v {} +>>$LOGFILE 2>&1

find /home/boudiccas/cron/obnam -type f -mtime +$NUM -name 'obnametc-ls-*.txt' -exec rm -v {} +>>$LOGFILE 2>&1

find /home/boudiccas/cron/obnam -type f -mtime +$NUM -name 'obnamvar-ls-*.txt' -exec rm -v {} +>>$LOGFILE 2>&1

# Change ownership of files from root to user.
chown boudiccas: /home/boudiccas/cron/obnam/obnametc-ls-*.txt

chown boudiccas: /home/boudiccas/cron/obnam/obnamvar-ls-*.txt

chown boudiccas: /home/boudiccas/cron/obnam/obnamhome-ls-*.txt

chown boudiccas: /home/boudiccas/cron/obnam/obnamback4-ls-*.txt

echo 'obnam-today finished', $LOGFILE

This gives the email message saying -

obnam-today finished, /home/boudiccas/logs/obnam-ls.txt

obnam generations

 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
#!/bin/bash -e
#: Title            : obnam-generations
#: Date             : June 2013
#: Author           : Sharon Kimble
#: Version          : 3.0
#: Description      : to give a complete dated list of all of obnams generations, run from $ROOT cron
#: Options          : 2, all listed in Variables
#: License          : GNU GPL 3.0 or later
####################################################
# Changelog - 22-7-13
# added extra lines to test.
####################################################
# Variables
NUM="6"     #number of backup files to keep
LOGFILE="/home/boudiccas/logs/obnam-generations.txt"
FILE="/home/boudiccas/bin/obnam-generations.$$"
####################################################

# Change into new directory
cd /home/boudiccas/cron/obnam

# Generate new file and save it
sudo -u boudiccas obnam generations>"obnamhome-gen-$(date +%Y-%m-%d).txt"

sudo -u boudiccas obnam --config=/etc/obnam-back4.conf generations>"obnamback4-gen-$(date +%Y-%m-%d).txt"

obnam --config=/etc/obnametc.conf generations>"obnametc-gen-$(date +%Y-%m-%d).txt"

obnam --config=/etc/obnamvar.conf generations>"obnamvar-gen-$(date +%Y-%m-%d).txt"

# Delete old backups!
find /home/boudiccas/cron/obnam -type f -mtime +$NUM -name 'obnamhome-gen-*.txt' -exec rm -v {} +>>$LOGFILE 2>&1

find /home/boudiccas/cron/obnam -type f -mtime +$NUM -name 'obnamback4-gen-*.txt' -exec rm -v {} +>>$LOGFILE 2>&1

find /home/boudiccas/cron/obnam -type f -mtime +$NUM -name 'obnametc-gen-*.txt' -exec rm -v {} +>>$LOGFILE 2>&1

find /home/boudiccas/cron/obnam -type f -mtime +$NUM -name 'obnamvar-gen-*.txt' -exec rm -v {} +>>$LOGFILE 2>&1

# Change ownership of files from root to user.
chown boudiccas: /home/boudiccas/cron/obnam/obnametc-gen-*.txt

chown boudiccas: /home/boudiccas/cron/obnam/obnamvar-gen-*.txt

chown boudiccas: /home/boudiccas/cron/obnam/obnamhome-gen-*.txt

chown boudiccas: /home/boudiccas/cron/obnam/obnamback4-gen-*.txt

echo 'obnam-generations finished', $LOGFILE


Comments

comments powered by Disqus