summaryrefslogtreecommitdiff
path: root/bin/duply-run
blob: 12c145f87cfe59290dacc9d5633340c50e813fe8 (plain)
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
#!/bin/bash
. $HOME/.shenv

set -e

ulimit -n 1024

# definitely don't use any keys from the SSH agent: this might bypass
# rrsync such that duplicity can't find its destination directory
unset SSH_AGENT_PID
unset SSH_AUTH_SOCK
export SSH_AGENT_PID
export SSH_AUTH_SOCK

# no longer on MetaArray
# # we want python 2 not python 3
# PATH=/usr/bin:$PATH
# export PATH

case "$(hostname -f)" in
    "ma.sdf.org")
        cd $HOME/src/dotfiles
        if ! [ "$(git rev-parse --abbrev-ref HEAD)" = "ma" ]; then
            echo "duply-run: cannot proceed: wrong dotfiles branch checked out" >&2
            echo "duply-run: checkout the \`ma' branch" >&2
            exit 1
        fi
        cd $HOME
        printf "\n>>> running home dir backup\n\n"
        duply ma-spw-home backup
        # printf "\n>>> running mail spool backup\n\n"
        # duply ma-spw-mail backup
        printf "\n>>> running web dir backup\n\n"
        duply ma-spw-www backup
        ;;
    "zephyr.silentflame.com")
        cd $HOME
        # if there's no key, backups have not been enabled on this
        # (presumably fresly-installed) host: exit silently
        if [ -e "$HOME/.ssh/id_duply" ]; then
        # force execution with duply in my dotfiles repo, not apt
        # package version installed system-wide (though $PATH from
        # .shenv should get this right anyway)
             offline || $HOME/bin/duply zephyr-swhitton-home-run backup_purge --force
        fi
        ;;
    "artemis.silentflame.com")
        cd $HOME
        offline || duply artemis-swhitton-home backup_purge --force
        ;;
    "athena.silentflame.com")
        # now available from backports
        # # use our own compiled version in order to get --s3-use-ia
        # export PYTHONPATH='/root/local/lib/python2.7/site-packages/'
	# export PATH=/root/local/bin:$PATH
	duply athena-root-run backup
        ;;
esac