4 if [ -z "$CMK_SITE_ID" ]; then
5 echo "ERROR: No site ID given"
9 trap 'omd stop '"$CMK_SITE_ID"'; exit 0' SIGTERM SIGHUP SIGINT
11 # Prepare local MTA for sending to smart host
12 # TODO: Syslog is only added to support postfix. Can we please find a better solution?
13 if [ ! -z "$MAIL_RELAY_HOST" ]; then
14 echo "### PREPARE POSTFIX (Hostname: $HOSTNAME, Relay host: $MAIL_RELAY_HOST)"
15 echo "$HOSTNAME" > /etc
/mailname
16 postconf
-e myorigin
="$HOSTNAME"
17 postconf
-e mydestination
="$(hostname -a), $(hostname -A), localhost.localdomain, localhost"
18 postconf
-e relayhost
="$MAIL_RELAY_HOST"
19 postconf
-e mynetworks
="127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128"
20 postconf
-e mailbox_size_limit
=0
21 postconf
-e recipient_delimiter
=+
22 postconf
-e inet_interfaces
=all
23 postconf
-e inet_protocols
=all
25 echo "### STARTING MAIL SERVICES"
27 /etc
/init.d
/postfix start
30 # Create the site in case it does not exist
32 # Check for a file in the directory because the directory itself might have
33 # been pre-created by docker when the --tmpfs option is used to create a
34 # site tmpfs below tmp.
35 if [ ! -d "/opt/omd/sites/$CMK_SITE_ID/etc" ] ; then
36 echo "### CREATING SITE '$CMK_SITE_ID'"
37 omd create
--no-tmpfs -u 1000 -g 1000 --admin-password "$CMK_PASSWORD" "$CMK_SITE_ID"
38 omd config
"$CMK_SITE_ID" set APACHE_TCP_ADDR
0.0.0.0
39 omd config
"$CMK_SITE_ID" set APACHE_TCP_PORT
5000
41 if [ "$CMK_LIVESTATUS_TCP" = "on" ]; then
42 omd config
"$CMK_SITE_ID" set LIVESTATUS_TCP on
46 # In case of an update (see update procedure docs) the container is started
47 # with the data volume mounted (the site is not re-created). In this
48 # situation only the site data directory is available and the "system level"
49 # parts are missing. Check for them here and create them.
50 ## TODO: This should be supported by a omd command (omd init or similar)
51 if ! getent group
"$CMK_SITE_ID" >/dev
/null
; then
52 groupadd
-g 1000 "$CMK_SITE_ID"
54 if ! getent passwd
"$CMK_SITE_ID" >/dev
/null
; then
55 useradd
-u 1000 -d "/omd/sites/$CMK_SITE_ID" -c "OMD site $CMK_SITE_ID" -g "$CMK_SITE_ID" -G omd
-s /bin
/bash
"$CMK_SITE_ID"
57 if [ ! -f "/omd/apache/$CMK_SITE_ID.conf" ]; then
58 echo "Include /omd/sites/$CMK_SITE_ID/etc/apache/mode.conf" > "/omd/apache/$CMK_SITE_ID.conf"
61 # When a command is given via "docker run" use it instead of this script
66 echo "### STARTING SITE"
67 omd start
"$CMK_SITE_ID"
69 echo "### STARTING CRON"
72 echo "### CONTAINER STARTED"