From 230a8f61b80e0b2b115234dc3a1edcfc8a52fe0b Mon Sep 17 00:00:00 2001 From: whyour Date: Sun, 18 Aug 2024 16:31:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20smtp=20python=20=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sample/config.sample.sh | 8 ++++++++ shell/otask.sh | 13 ++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/sample/config.sample.sh b/sample/config.sample.sh index ee9d6263..b6f357d0 100644 --- a/sample/config.sample.sh +++ b/sample/config.sample.sh @@ -175,8 +175,16 @@ export CHRONOCAT_QQ="" export CHRONOCAT_TOKEN="" ## 16. SMTP +## JavaScript 参数 ## 邮箱服务名称,比如126、163、Gmail、QQ等,支持列表 https://github.com/nodemailer/nodemailer/blob/master/lib/well-known/services.json export SMTP_SERVICE="" + +## Python 参数 +## SMTP 发送邮件服务器,形如 smtp.exmail.qq.com:465 +export SMTP_SERVER="" +## SMTP 发送邮件服务器是否使用 SSL,填写 true 或 false +export SMTP_SSL="" + ## smtp_email 填写 SMTP 收发件邮箱,通知将会由自己发给自己 export SMTP_EMAIL="" ## smtp_password 填写 SMTP 登录密码,也可能为特殊口令,视具体邮件服务商说明而定 diff --git a/shell/otask.sh b/shell/otask.sh index 1ac2e9ac..af8dbc5b 100755 --- a/shell/otask.sh +++ b/shell/otask.sh @@ -100,7 +100,7 @@ run_normal() { if [[ $isJsOrPythonFile == 'false' ]]; then clear_non_sh_env fi - $timeoutCmd $which_program $file_param "${script_params[@]:-''}" + $timeoutCmd $which_program $file_param "${script_params[@]}" } handle_env_split() { @@ -143,7 +143,7 @@ run_concurrent() { export "${env_param}=${array[$i - 1]}" clear_non_sh_env fi - eval envParam="${env_param}" numParam="${i}" $timeoutCmd $which_program $file_param "${script_params[@]:-''}" &>$single_log_path & + eval envParam="${env_param}" numParam="${i}" $timeoutCmd $which_program $file_param "${script_params[@]}" &>$single_log_path & done wait @@ -188,7 +188,7 @@ run_designated() { file_param=${file_param/$relative_path\//} fi - envParam="${env_param}" numParam="${num_param}" $timeoutCmd $which_program $file_param "${script_params[@]:-''}" + envParam="${env_param}" numParam="${num_param}" $timeoutCmd $which_program $file_param "${script_params[@]}" } ## 运行其他命令 @@ -269,7 +269,14 @@ check_file "${task_shell_params[@]}" if [[ $isJsOrPythonFile == 'false' ]]; then run_task_before "${task_shell_params[@]}" fi +if set -o | grep -q 'nounset.*on'; then + set_u_on="true" + set +u +fi main "${task_shell_params[@]}" +if [[ "$set_u_on" == 'true' ]]; then + set -u +fi if [[ $isJsOrPythonFile == 'true' ]]; then export NODE_OPTIONS="${PREV_NODE_OPTIONS}" export PYTHONPATH="${PREV_PYTHONPATH}"