This is not a post showing how to unlock an account in obnam, but a down and dirty unlock script that I use for those occasions when I get a locked backup and I cant be bothered to work out the configuration of 'force-lock'.

 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
#: Title            : unlock
#: Date             : November 2013
#: Author           : Sharon Kimble
#: Version          : 2.1
#: Description      : to remove all 'lock' files from my obnam backup files
#: Options          : 8, as listed in variables
#: License          : GNU GPL 3.0 or later
####################################################
# Change log 
# 3-10-13 
#   * Initial release
# 4-10-13
#   * Started logging
# 7-11-13
#   * cleaned up the script
#   * added in obnam-back4
################################################### 
# Variables 
chunk="/media/boudiccas/backup/obnam-home2" #site of backup files
chunk2="/media/boudiccas/backup/obnam-back4"    #site of backup4 files
bignum="5042396860350391879"    #unique id number of backup series
bignum2="5068550679861121148"   #unique id number of backup4 series
logto="/home/boudiccas/logs/unlock-$(/bin/date +%Y%m%d-%R).txt" #log of where lock-file isn't
mainlog="/home/boudiccas/logs/obnam.txt" #main log of backup where everything is logged
sender="$user@localhost"
subj="Files unlocked."
####################################################
{
    rm "$chunk"/chunklist/lock
    rm "$chunk"/"$bignum"/lock
    rm "$chunk"/chunksums/lock 
    rm "$chunk"/chunks/lock 
    rm "$chunk"/clientlist/lock 
    rm "$chunk"/metadata/lock
} 2> >(tee "$logto" | tee -a "$mainlog" > /dev/tty ) | tee outlog | tee -a "$mainlog"

mailx -s "$subj" boudiccas@localhost < "$logto"

{
    rm "$chunk2"/chunklist/lock
    rm "$chunk2"/"$bignum2"/lock
    rm "$chunk2"/chunksums/lock 
    rm "$chunk2"/chunks/lock 
    rm "$chunk2"/clientlist/lock 
    rm "$chunk2"/metadata/lock
} 2> >(tee "$logto" | tee -a "$mainlog" > /dev/tty ) | tee outlog | tee -a "$mainlog"

mailx -s "$subj" boudiccas@localhost < "$logto"

This is stored in /home/$users/bin/ and just called as unlock. Again, this is in my git repo if you're interested in it.

Update

I have included this as an illustration of coding. Its now far simpler and easier to use the obnam command force-lock as here shown -

obnam --config=/home/$USER/cron/conf/obnam.conf force-lock

This shows the ’command - obnam’, the ’directory where the config file is stored --config=/home/$USER/cron/conf/obnam.conf’, and lastly what you want obnam to do force-lock.



Comments

comments powered by Disqus