#!/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-into-stck/" # 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-into-stck" ]]; then log_err "文件夹中缺少minio-into-stck(主程序),无法运行" && exit 1 fi if [[ ! -x "$base_dir/minio-into-stck" ]]; then log_err "minio-into-stck无可执行权限,无法运行。请使用chmod" && exit 1 fi if [[ ! -f "$base_dir/license/license_key.json" ]]; then log_warn "您可能未开始、或未完成授权过程.现在生成key,请之后完成授权过程再启动此脚本" # exit 1 fi ################################################################################################### if ps -auxc | grep "minio-into-stck" | grep -v grep > /dev/null; then log_info "minio-into-stck已在运行" else if [[ ! -d $log_path ]]; then mkdir "$log_path" fi log_file="minio-into-stck_$(date "+%Y-%m-%d-%H:%M:%S").log" ./minio-into-stck server --config-file=$base_dir/config/config.xml &> "${log_path}${log_file}" & ./status.sh fi