修复 shell 变量初始化检查,更新 sentry 版本

This commit is contained in:
whyour
2024-08-18 14:19:45 +08:00
parent a743aa8115
commit af5de8372c
14 changed files with 799 additions and 144 deletions
+6 -8
View File
@@ -1,6 +1,5 @@
#!/usr/bin/env bash
## 导入通用变量与函数
dir_shell=$QL_DIR/shell
. $dir_shell/share.sh
. $dir_shell/api.sh
@@ -11,7 +10,6 @@ single_hanle() {
exit 1
}
## 选择python3还是node
define_program() {
local file_param=$1
if [[ $file_param == *.js ]] || [[ $file_param == *.mjs ]]; then
@@ -34,7 +32,7 @@ handle_log_path() {
file_param="task"
fi
if [[ -z $ID ]]; then
if [[ -z ${ID:=} ]]; then
ID=$(cat $list_crontab_user | grep -E "$cmd_task.* $file_param" | perl -pe "s|.*ID=(.*) $cmd_task.* $file_param\.*|\1|" | head -1 | awk -F " " '{print $1}')
fi
local suffix=""
@@ -62,17 +60,17 @@ handle_log_path() {
log_dir="${log_dir_tmp%.*}${suffix}"
log_path="$log_dir/$log_time.log"
if [[ $real_log_path ]]; then
if [[ ${real_log_path:=} ]]; then
log_path="$real_log_path"
fi
cmd="2>&1 | tee -a $dir_log/$log_path"
make_dir "$dir_log/$log_dir"
if [[ "$no_tee" == "true" ]]; then
if [[ "${no_tee:=}" == "true" ]]; then
cmd=">> $dir_log/$log_path 2>&1"
fi
if [[ "$real_time" == "true" ]]; then
if [[ "${real_time:=}" == "true" ]]; then
cmd=""
fi
}
@@ -124,8 +122,8 @@ while getopts ":lm:" opt; do
;;
esac
done
[[ $show_log ]] && shift $(($OPTIND - 1))
if [[ $max_time ]]; then
[[ ${show_log:=} ]] && shift $(($OPTIND - 1))
if [[ ${max_time:=} ]]; then
shift $(($OPTIND - 1))
command_timeout_time="$max_time"
fi