修复cron id获取

This commit is contained in:
hanhh 2021-05-24 20:52:53 +08:00
parent 91e4905a3f
commit 92056d66b5
2 changed files with 3 additions and 3 deletions

View File

@ -99,9 +99,9 @@ update_cron_command_api() {
code=$(echo $api | jq -r .code) code=$(echo $api | jq -r .code)
message=$(echo $api | jq -r .message) message=$(echo $api | jq -r .message)
if [[ $code == 200 ]]; then if [[ $code == 200 ]]; then
echo -e "$name -> 更新成功" echo -e "$command -> 更新成功"
else else
echo -e "$name -> 更新失败(${message})" echo -e "$command -> 更新失败(${message})"
fi fi
} }

View File

@ -345,7 +345,7 @@ gen_list_repo() {
filename=$(basename $file) filename=$(basename $file)
cp -f $file $dir_scripts/${repo}_${filename} cp -f $file $dir_scripts/${repo}_${filename}
echo ${repo}_${filename} >>"$dir_list_tmp/${repo}_scripts.list" echo ${repo}_${filename} >>"$dir_list_tmp/${repo}_scripts.list"
cron_id=$(grep -E "$cmd_task ${author}_${filename}" $list_crontab_user | perl -pe "s|.*ID=(.*) $cmd_task ${author}_${filename}\.*|\1|") cron_id=$(cat $list_crontab_user | grep -E "$cmd_task ${author}_${filename}" | perl -pe "s|.*ID=(.*) $cmd_task ${author}_${filename}\.*|\1|")
if [[ $cron_id ]]; then if [[ $cron_id ]]; then
result=$(update_cron_command_api "$cmd_task ${repo}_${filename}:$cron_id") result=$(update_cron_command_api "$cmd_task ${repo}_${filename}:$cron_id")
fi fi