mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-23 23:06:06 +08:00
修复shell本地开发兼容性
This commit is contained in:
parent
c09c375066
commit
2e26a8c24e
|
@ -7,6 +7,6 @@ LOG_LEVEL='debug'
|
||||||
|
|
||||||
SECRET='whyour'
|
SECRET='whyour'
|
||||||
|
|
||||||
QINIU_AK = ''
|
QINIU_AK=''
|
||||||
QINIU_SK = ''
|
QINIU_SK=''
|
||||||
QINIU_SCOPE = ''
|
QINIU_SCOPE=''
|
|
@ -64,5 +64,9 @@ export default async () => {
|
||||||
|
|
||||||
dotenv.config({ path: confFile });
|
dotenv.config({ path: confFile });
|
||||||
|
|
||||||
|
// 声明QL_DIR环境变量
|
||||||
|
const qlHomePath = path.join(__dirname, '../../');
|
||||||
|
process.env.QL_DIR = qlHomePath;
|
||||||
|
|
||||||
Logger.info('✌️ Init file down');
|
Logger.info('✌️ Init file down');
|
||||||
};
|
};
|
||||||
|
|
|
@ -118,12 +118,13 @@ run_normal() {
|
||||||
cd ${relative_path}
|
cd ${relative_path}
|
||||||
file_param=${file_param/$relative_path\//}
|
file_param=${file_param/$relative_path\//}
|
||||||
fi
|
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
|
eval . $file_task_after "$@" $cmd
|
||||||
local end_time=$(date '+%Y-%m-%d %H:%M:%S')
|
local end_time=$(date '+%Y-%m-%d %H:%M:%S')
|
||||||
local end_timestamp=$(date "+%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"
|
[[ $id ]] && update_cron "\"$id\"" "1" "" "$log_path" "$begin_timestamp" "$diff_time"
|
||||||
eval echo -e "\\\n\#\# 执行结束... $end_time 耗时 $diff_time 秒" $cmd
|
eval echo -e "\\\n\#\# 执行结束... $end_time 耗时 $diff_time 秒" $cmd
|
||||||
}
|
}
|
||||||
|
@ -196,7 +197,7 @@ run_concurrent() {
|
||||||
for i in "${!array[@]}"; do
|
for i in "${!array[@]}"; do
|
||||||
export ${env_param}=${array[i]}
|
export ${env_param}=${array[i]}
|
||||||
single_log_path="$dir_log/$log_dir/${single_log_time}_$((i + 1)).log"
|
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
|
done
|
||||||
|
|
||||||
wait
|
wait
|
||||||
|
@ -274,7 +275,7 @@ run_designated() {
|
||||||
cd ${relative_path}
|
cd ${relative_path}
|
||||||
file_param=${file_param/$relative_path\//}
|
file_param=${file_param/$relative_path\//}
|
||||||
fi
|
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
|
eval . $file_task_after "$@" $cmd
|
||||||
local end_time=$(date '+%Y-%m-%d %H:%M:%S')
|
local end_time=$(date '+%Y-%m-%d %H:%M:%S')
|
||||||
|
@ -325,7 +326,7 @@ run_else() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
shift
|
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
|
eval . $file_task_after "$file_param" "$@" $cmd
|
||||||
local end_time=$(date '+%Y-%m-%d %H:%M:%S')
|
local end_time=$(date '+%Y-%m-%d %H:%M:%S')
|
||||||
|
@ -348,6 +349,11 @@ main() {
|
||||||
done
|
done
|
||||||
[[ "$show_log" == "true" ]] && shift $(($OPTIND - 1))
|
[[ "$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
|
if [[ $1 == *.js ]] || [[ $1 == *.py ]] || [[ $1 == *.sh ]] || [[ $1 == *.ts ]]; then
|
||||||
case $# in
|
case $# in
|
||||||
1)
|
1)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user