-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-entrypoint.sh
executable file
·48 lines (38 loc) · 1.16 KB
/
docker-entrypoint.sh
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
#!/bin/bash -e
DATA_DIR=/backup
CFG=/root/.shaback.lua
shaback version
SHABACK_REPO_FORMAT=${SHABACK_REPO_FORMAT:-3}
init_opts=""
echo "setRepository('${DATA_DIR}')" > ${CFG}
echo "setOneFileSystem(false)" >> ${CFG}
echo "addDir('/src')" >> ${CFG}
echo "setBackupName('${HOSTNAME}')" >> ${CFG}
if [ -n "${SHABACK_PASSWORD}" ]; then
echo "setCryptoPassword('${SHABACK_PASSWORD}')" >> ${CFG}
init_opts="${init_opts} -p ${SHABACK_PASSWORD} -E Blowfish"
fi
echo ${SHABACK_LUA} >> ${CFG}
if [ -n "${AWS_ACCESS_KEY_ID}" ]; then
aws configure set aws_access_key_id ${AWS_ACCESS_KEY_ID}
aws configure set aws_secret_access_key ${AWS_SECRET_ACCESS_KEY}
if [ -n "${AWS_DEFAULT_REGION}" ]; then
aws configure set aws_default_region ${AWS_DEFAULT_REGION}
fi
fi
cd ${DATA_DIR}
umask 0022
test -f repo.properties || \
shaback init \
--repo-format=${SHABACK_REPO_FORMAT} \
${init_opts} \
${SHABACK_INIT_OPTIONS}
if [ -n "${SHABACK_CRONTAB}" ]; then
rm -f ${DATA_DIR}/locks/*
echo "Starting cron"
crontab <<< $SHABACK_CRONTAB
exec cron -f
else
echo "Running shaback $@"
exec shaback ${SHABACK_OPTIONS} $@
fi