forked from belsander/docker-cronicle
-
Notifications
You must be signed in to change notification settings - Fork 2
/
entrypoint.sh
40 lines (32 loc) · 1.09 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
38
39
40
#!/bin/bash
ROOT_DIR=/opt/cronicle
CONF_DIR=$ROOT_DIR/conf
BIN_DIR=$ROOT_DIR/bin
LIB_DIR=$ROOT_DIR/lib
# DATA_DIR needs to be the same as the exposed Docker volume in Dockerfile
DATA_DIR=$ROOT_DIR/data
# PLUGINS_DIR needs to be the same as the exposed Docker volume in Dockerfile
PLUGINS_DIR=$ROOT_DIR/plugins
# The env variables below are needed for Docker and cannot be overwritten
export CRONICLE_Storage__Filesystem__base_dir=${DATA_DIR}
export NODE_EXTRA_CA_CERTS=/etc/ssl/certs/ca-certificates.crt
export CRONICLE_echo=1
export CRONICLE_foreground=1
# Only run setup when setup needs to be done
if [ ! -f $DATA_DIR/.setup_done ]
then
$BIN_DIR/control.sh setup
cp $CONF_DIR/config.json $CONF_DIR/config.json.origin
if [ -f $DATA_DIR/config.json.import ]
then
# Move in custom configuration
cp $DATA_DIR/config.json.import $CONF_DIR/config.json
fi
# Create plugins directory
mkdir -p $PLUGINS_DIR
# Marking setup done
touch $DATA_DIR/.setup_done
fi
# Run cronicle with unprivileged user
chown -R cronicle:cronicle data/ logs/
exec su cronicle -c "/opt/cronicle/bin/control.sh start"