修改shell语法

This commit is contained in:
whyour 2021-11-05 23:39:22 +08:00
parent 2b70851074
commit 65ade4b996
7 changed files with 31 additions and 31 deletions

View File

@ -8,7 +8,7 @@ set -e
echo -e "======================1. 检测配置文件========================\n"
cp -fv $nginx_conf /etc/nginx/nginx.conf
cp -fv $nginx_app_conf /etc/nginx/conf.d/front.conf
pm2 l >/dev/null 2>&1
pm2 l &>/dev/null
echo
echo -e "======================2. 安装依赖========================\n"
@ -20,7 +20,7 @@ nginx -s reload 2>/dev/null || nginx -c /etc/nginx/nginx.conf
echo -e "nginx启动成功...\n"
echo -e "======================4. 启动控制面板========================\n"
if [[ $(pm2 info panel 2>/dev/null) ]]; then
if test -z "$(pm2 info panel 1>/dev/null)"; then
pm2 reload panel --source-map-support --time
else
pm2 start $dir_root/build/app.js -n panel --source-map-support --time
@ -28,7 +28,7 @@ fi
echo -e "控制面板启动成功...\n"
echo -e "======================5. 启动定时任务========================\n"
if [[ $(pm2 info schedule 2>/dev/null) ]]; then
if test -z "$(pm2 info schedule 1>/dev/null)"; then
pm2 reload schedule --source-map-support --time
else
pm2 start $dir_root/build/schedule.js -n schedule --source-map-support --time

View File

@ -1 +0,0 @@
requests

View File

@ -27,8 +27,15 @@ if [[ $PipMirror ]]; then
pip3 config set global.index-url $PipMirror
fi
cp -f "$repo_path/jbot/requirements.txt" "$dir_root"
cd $dir_root
pip3 --default-timeout=100 install -r requirements.txt --no-cache-dir
cat requirements.txt | while read LREAD
do
if test ! -z "$(pip3 show "${LREAD%%=*}" 1>/dev/null)"; then
pip3 --default-timeout=100 install ${LREAD}
fi
done
echo -e "\npython3依赖安装成功...\n"
echo -e "4、启动bot程序...\n"

View File

@ -37,18 +37,18 @@ copy_dep() {
}
reload_pm2() {
pm2 l >/dev/null 2>&1
pm2 l &>/dev/null
if [[ $(pm2 info panel 2>/dev/null) ]]; then
pm2 reload panel --source-map-support --time >/dev/null 2>&1
if test -z "$(pm2 info panel 1>/dev/null)"; then
pm2 reload panel --source-map-support --time &>/dev/null
else
pm2 start $dir_root/build/app.js -n panel --source-map-support --time >/dev/null 2>&1
pm2 start $dir_root/build/app.js -n panel --source-map-support --time &>/dev/null
fi
if [[ $(pm2 info schedule 2>/dev/null) ]]; then
pm2 reload schedule --source-map-support --time >/dev/null 2>&1
if test -z "$(pm2 info schedule 1>/dev/null)"; then
pm2 reload schedule --source-map-support --time &>/dev/null
else
pm2 start $dir_root/build/schedule.js -n schedule --source-map-support --time >/dev/null 2>&1
pm2 start $dir_root/build/schedule.js -n schedule --source-map-support --time &>/dev/null
fi
}

View File

@ -125,7 +125,7 @@ link_shell() {
define_cmd() {
local cmd_prefix cmd_suffix
if type task >/dev/null 2>&1; then
if type task &>/dev/null; then
cmd_suffix=""
if [[ -x "$dir_shell/task.sh" ]]; then
cmd_prefix=""
@ -213,7 +213,7 @@ fix_config() {
npm_install_sub() {
if [[ $is_termux -eq 1 ]]; then
npm install --production --no-save --no-bin-links --registry=https://registry.npm.taobao.org || npm install --production --no-bin-links --no-save
elif ! type pnpm >/dev/null 2>&1; then
elif ! type pnpm &>/dev/null; then
npm install --production --no-save --registry=https://registry.npm.taobao.org || npm install --production --no-save
else
pnpm install --prod
@ -261,12 +261,6 @@ update_depend() {
npm_install_2 $dir_scripts
fi
if [[ ! -s $dir_scripts/requirements.txt ]] || [[ $(diff $dir_sample/requirements.txt $dir_scripts/requirements.txt) ]]; then
cp -f $dir_sample/requirements.txt $dir_scripts/requirements.txt
cd $dir_scripts
pip3 install -r $dir_scripts/requirements.txt
fi
cd $dir_current
}

View File

@ -88,7 +88,7 @@ run_normal() {
log_dir_tmp="${first_param##*/}"
log_dir="$dir_log/${log_dir_tmp%%.*}"
log_path="$log_dir/$log_time.log"
cmd=">> $log_path 2>&1"
cmd="&>> $log_path"
[[ "$show_log" == "true" ]] && cmd=""
make_dir "$log_dir"
@ -141,7 +141,7 @@ run_concurrent() {
log_dir_tmp="${first_param##*/}"
log_dir="$dir_log/${log_dir_tmp%%.*}"
log_path="$log_dir/$log_time.log"
cmd=">> $log_path 2>&1"
cmd="&>> $log_path"
[[ "$show_log" == "true" ]] && cmd=""
make_dir $log_dir
@ -196,7 +196,7 @@ run_designated() {
log_dir_tmp="${file_param##*/}"
log_dir="$dir_log/${log_dir_tmp%%.*}"
log_path="$log_dir/$log_time.log"
cmd=">> $log_path 2>&1"
cmd="&>> $log_path"
[[ "$show_log" == "true" ]] && cmd=""
make_dir $log_dir
@ -242,7 +242,7 @@ run_else() {
local log_dir_tmp="${1##*/}"
local log_dir="$dir_log/${log_dir_tmp%%.*}"
log_path="$log_dir/$log_time.log"
cmd=">> $log_path 2>&1"
cmd="&>> $log_path"
[[ "$show_log" == "true" ]] && cmd=""
make_dir "$log_dir"

View File

@ -305,7 +305,7 @@ patch_version() {
echo
fi
if ! type ts-node >/dev/null 2>&1; then
if ! type ts-node &>/dev/null; then
pnpm i -g ts-node typescript tslib
fi
@ -313,18 +313,18 @@ patch_version() {
}
reload_pm2() {
pm2 l >/dev/null 2>&1
pm2 l &>/dev/null
if [[ $(pm2 info panel 2>/dev/null) ]]; then
pm2 reload panel --source-map-support --time >/dev/null 2>&1
pm2 reload panel --source-map-support --time &>/dev/null
else
pm2 start $dir_root/build/app.js -n panel --source-map-support --time >/dev/null 2>&1
pm2 start $dir_root/build/app.js -n panel --source-map-support --time &>/dev/null
fi
if [[ $(pm2 info schedule 2>/dev/null) ]]; then
pm2 reload schedule --source-map-support --time >/dev/null 2>&1
pm2 reload schedule --source-map-support --time &>/dev/null
else
pm2 start $dir_root/build/schedule.js -n schedule --source-map-support --time >/dev/null 2>&1
pm2 start $dir_root/build/schedule.js -n schedule --source-map-support --time &>/dev/null
fi
}
@ -369,7 +369,7 @@ gen_list_repo() {
local dependence="$5"
local repo="${repo_path##*/}"
rm -f $dir_list_tmp/${repo}*.list >/dev/null 2>&1
rm -f $dir_list_tmp/${repo}*.list &>/dev/null
cd ${repo_path}