diff --git a/.env.example b/.env.example index 2fe81775..fe8bd0ba 100644 --- a/.env.example +++ b/.env.example @@ -7,6 +7,6 @@ LOG_LEVEL='debug' SECRET='whyour' -QINIU_AK = '' -QINIU_SK = '' -QINIU_SCOPE = '' \ No newline at end of file +QINIU_AK='' +QINIU_SK='' +QINIU_SCOPE='' \ No newline at end of file diff --git a/back/loaders/initFile.ts b/back/loaders/initFile.ts index 1c06692d..9e9c3b92 100644 --- a/back/loaders/initFile.ts +++ b/back/loaders/initFile.ts @@ -64,5 +64,9 @@ export default async () => { dotenv.config({ path: confFile }); + // 声明QL_DIR环境变量 + const qlHomePath = path.join(__dirname, '../../'); + process.env.QL_DIR = qlHomePath; + Logger.info('✌️ Init file down'); }; diff --git a/shell/task.sh b/shell/task.sh index ba486682..914fd14c 100755 --- a/shell/task.sh +++ b/shell/task.sh @@ -118,12 +118,13 @@ run_normal() { cd ${relative_path} file_param=${file_param/$relative_path\//} fi - eval timeout -k 10s $command_timeout_time $which_program $file_param $cmd + + eval $timeoutCmd $which_program $file_param $cmd eval . $file_task_after "$@" $cmd local end_time=$(date '+%Y-%m-%d %H:%M:%S') local end_timestamp=$(date "+%s") - local diff_time=$(( $end_timestamp - $begin_timestamp )) + local diff_time=$(expr $end_timestamp - $begin_timestamp) [[ $id ]] && update_cron "\"$id\"" "1" "" "$log_path" "$begin_timestamp" "$diff_time" eval echo -e "\\\n\#\# 执行结束... $end_time 耗时 $diff_time 秒" $cmd } @@ -196,7 +197,7 @@ run_concurrent() { for i in "${!array[@]}"; do export ${env_param}=${array[i]} single_log_path="$dir_log/$log_dir/${single_log_time}_$((i + 1)).log" - timeout -k 10s $command_timeout_time $which_program $file_param &>$single_log_path & + eval $timeoutCmd $which_program $file_param &>$single_log_path & done wait @@ -274,7 +275,7 @@ run_designated() { cd ${relative_path} file_param=${file_param/$relative_path\//} fi - eval timeout -k 10s $command_timeout_time $which_program $file_param $cmd + eval $timeoutCmd $which_program $file_param $cmd eval . $file_task_after "$@" $cmd local end_time=$(date '+%Y-%m-%d %H:%M:%S') @@ -325,7 +326,7 @@ run_else() { fi shift - eval timeout -k 10s $command_timeout_time $which_program "$file_param" "$@" $cmd + eval $timeoutCmd $which_program "$file_param" "$@" $cmd eval . $file_task_after "$file_param" "$@" $cmd local end_time=$(date '+%Y-%m-%d %H:%M:%S') @@ -348,6 +349,11 @@ main() { done [[ "$show_log" == "true" ]] && shift $(($OPTIND - 1)) + timeoutCmd="" + if type timeout &>/dev/null; then + timeoutCmd="timeout -k 10s $command_timeout_time " + fi + if [[ $1 == *.js ]] || [[ $1 == *.py ]] || [[ $1 == *.sh ]] || [[ $1 == *.ts ]]; then case $# in 1)