feat: support start the container as non-root user (close #45, close #47)

This commit is contained in:
ttionya
2022-06-30 23:30:51 +08:00
parent 44da441de0
commit c24263dd25
3 changed files with 9 additions and 9 deletions
+5 -8
View File
@@ -37,16 +37,13 @@ if [[ "$1" == "restore" ]]; then
fi
function configure_timezone() {
if [[ ! -f /etc/localtime || ! -f /etc/timezone ]]; then
cp -f "/usr/share/zoneinfo/${TIMEZONE}" /etc/localtime
echo "${TIMEZONE}" > /etc/timezone
fi
ln -sf "/usr/share/zoneinfo/${TIMEZONE}" /tmp/localtime
}
function configure_cron() {
local FIND_CRON_COUNT=$(crontab -l | grep -c 'backup.sh')
if [[ ${FIND_CRON_COUNT} -eq 0 ]]; then
echo "${CRON} bash /app/backup.sh > /dev/stdout" >> /etc/crontabs/root
local FIND_CRON_COUNT="$(grep -c 'backup.sh' "${CRON_CONFIG_FILE}" 2> /dev/null)"
if [[ "${FIND_CRON_COUNT}" -eq 0 ]]; then
echo "${CRON} bash /app/backup.sh" >> "${CRON_CONFIG_FILE}"
fi
}
@@ -56,4 +53,4 @@ configure_timezone
configure_cron
# foreground run crond
crond -l 2 -f
supercronic -passthrough-logs -quiet "${CRON_CONFIG_FILE}"