3 # ============LICENSE_START=======================================================
5 # ================================================================================
6 # Copyright (C) 2018 AT&T Intellectual Property. All rights
8 # ================================================================================
9 # Licensed under the Apache License, Version 2.0 (the "License");
10 # you may not use this file except in compliance with the License.
11 # You may obtain a copy of the License at
13 # http://www.apache.org/licenses/LICENSE-2.0
15 # Unless required by applicable law or agreed to in writing, software
16 # distributed under the License is distributed on an "AS IS" BASIS,
17 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 # See the License for the specific language governing permissions and
19 # limitations under the License.
20 # ============LICENSE_END============================================
21 # ===================================================================
24 KIBANA_CONF_FILE="/usr/share/kibana/config/kibana.yml"
25 SAVED_OBJECTS_ROOT="/saved-objects/"
26 RESTORE_CMD="/usr/local/bin/restore.py -H http://127.0.0.1:5601/ -f"
27 BACKUP_BIN="/usr/local/bin/backup.py"
28 KIBANA_START_CMD="/usr/local/bin/kibana-docker"
29 LOG_FILE="/tmp/load.kibana.log"
30 KIBANA_LOAD_CMD="/usr/local/bin/kibana-docker -H 127.0.0.1 -l $LOG_FILE"
34 if [ -n "$(ls -A ${SAVED_OBJECTS_PATH})" ];
36 echo "---- Saved objects found, restoring files."
41 # Wait for log file to be avaiable
43 while [ ! -f $LOG_FILE ] && [ "$LOG_TIMEOUT" -gt "0" ];
45 echo "Waiting for $LOG_FILE to be available..."
47 let LOG_TIMEOUT=$LOG_TIMEOUT-$WAIT_TIME
53 # Wait for kibana to be listening
54 while [ -z "$(grep "Server running at" $LOG_FILE)" ] && [ "$TIMEOUT" -gt "0" ];
56 echo "Waiting for kibana to start..."
58 let TIMEOUT=$TIMEOUT-$WAIT_TIME
63 for saved_objects_path in $SAVED_OBJECTS_ROOT/*
65 echo "Restoring content of $saved_objects_path"
66 $RESTORE_CMD -C $saved_objects_path
74 echo "---- No saved object found"
75 ls -A ${SAVED_OBJECTS_PATH}
78 echo "---- Starting kibana"