-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
37 lines (32 loc) · 1.17 KB
/
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
#!/usr/bin/env bash
echo "Container starting..."
. prepare.sh
. access-init.sh
mkdir -p "${GWBACKUPY_TEMPDIR}"
mkdir -p "${GWBACKUPY_LOGDIR}"
# setup logrotate
LOGROTATE_CONF="${GWBACKUPY_APPDIR}/logrotate.conf"
cat <<EOF >"${LOGROTATE_CONF}"
${GWBACKUPY_CRON_LOG} {
rotate 8
weekly
compress
delaycompress
missingok
notifempty
}
EOF
# setup crons
touch "${GWBACKUPY_CRON_LOG}"
echo "13 * * * * /usr/bin/flock ${GWBACKUPY_CRON_FLOCK_FILEPATH} logrotate -f ${LOGROTATE_CONF}" >>"${GWBACKUPY_CRONTAB}"
if [[ "$GWBACKUPY_CRON_FULL_SYNC" != "" ]]; then
echo "$GWBACKUPY_CRON_FULL_SYNC /usr/bin/flock ${GWBACKUPY_CRON_FLOCK_FILEPATH} /bin/bash ${GWBACKUPY_APPDIR}/logcmd.sh ${GWBACKUPY_APPDIR}/sync.sh >> ${GWBACKUPY_CRON_LOG} 2>&1" >>"${GWBACKUPY_CRONTAB}"
fi
if [[ "$GWBACKUPY_CRON_QUICK_SYNC" != "" ]]; then
echo "${GWBACKUPY_CRON_QUICK_SYNC} sleep 1; /usr/bin/flock -xn ${GWBACKUPY_CRON_FLOCK_FILEPATH} /bin/bash ${GWBACKUPY_APPDIR}/logcmd.sh ${GWBACKUPY_APPDIR}/quick-sync.sh >> ${GWBACKUPY_CRON_LOG} 2>&1" >>"${GWBACKUPY_CRONTAB}"
fi
crontab "${GWBACKUPY_CRONTAB}"
echo "Installed cron jobs:"
crontab -l
echo "Run crond"
crond && tail -f "${GWBACKUPY_CRON_LOG}"