|
@@ -0,0 +1,76 @@
|
|
|
+#!/usr/bin/env bash
|
|
|
+set +u
|
|
|
+set -e
|
|
|
+# set -x
|
|
|
+base_dir=$(
|
|
|
+ cd "$(dirname "$0")"
|
|
|
+ pwd
|
|
|
+)
|
|
|
+cd $base_dir
|
|
|
+echo $base_dir
|
|
|
+# ./auto_del_log.sh
|
|
|
+function log_warn() {
|
|
|
+ local date=$(date "+%Y-%m-%d-%H:%M:%S")
|
|
|
+ local para=$1
|
|
|
+ echo "[WARN] $date $1" | tee -a "./log/run_log"
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+function log_info() {
|
|
|
+ local date=$(date "+%Y-%m-%d-%H:%M:%S")
|
|
|
+ local para=$1
|
|
|
+ echo "[INFO] $date $1" | tee -a "./log/run_log"
|
|
|
+}
|
|
|
+
|
|
|
+function log_err() {
|
|
|
+ local date=$(date "+%Y-%m-%d-%H:%M:%S")
|
|
|
+ local para=$1
|
|
|
+ echo "[ERROR] $date $1" | tee -a "./log/run_log"
|
|
|
+}
|
|
|
+
|
|
|
+ulimit -n 100000
|
|
|
+if [[ $1 != "no_logo" ]]; then
|
|
|
+ cat << 'LOGO'
|
|
|
+###############################################################
|
|
|
+
|
|
|
+ 配置文件:
|
|
|
+ ./config/
|
|
|
+
|
|
|
+###############################################################
|
|
|
+LOGO
|
|
|
+else
|
|
|
+ shift 1
|
|
|
+fi
|
|
|
+
|
|
|
+# parameter set
|
|
|
+log_path="./log/minio-store/"
|
|
|
+
|
|
|
+# extra function
|
|
|
+if [[ ! -d "$base_dir/log" ]]; then
|
|
|
+ echo "log文件夹不存在,创建log文件夹" && mkdir "./log"
|
|
|
+fi
|
|
|
+
|
|
|
+# preparation check
|
|
|
+if [[ ! -d "$base_dir/lib" ]]; then
|
|
|
+ log_err "缺少lib文件夹,请查证后重新运行此脚本" && exit 1
|
|
|
+fi
|
|
|
+
|
|
|
+if [[ ! -f "$base_dir/minio-launcher.sh" ]]; then
|
|
|
+ log_err "文件夹中缺少minio-store(主程序),无法运行" && exit 1
|
|
|
+fi
|
|
|
+
|
|
|
+if [[ ! -x "$base_dir/minio-launcher.sh" ]]; then
|
|
|
+ log_err "minio-store无可执行权限,无法运行。请使用chmod" && exit 1
|
|
|
+fi
|
|
|
+
|
|
|
+###################################################################################################
|
|
|
+if ps -auxc | grep "minio-store" | grep -v grep > /dev/null; then
|
|
|
+ log_info "minio-store已在运行"
|
|
|
+else
|
|
|
+ if [[ ! -d $log_path ]]; then
|
|
|
+ mkdir "$log_path"
|
|
|
+ fi
|
|
|
+ log_file="minio-store_$(date "+%Y-%m-%d-%H:%M:%S").log"
|
|
|
+ ./minio-launcher.sh server --config-file=$base_dir/config/config.xml &> "${log_path}${log_file}" &
|
|
|
+ ./status.sh
|
|
|
+fi
|