mirror of
				https://github.com/whyour/qinglong.git
				synced 2025-11-01 01:16:07 +08:00 
			
		
		
		
	Merge branch 'develop' of https://github.com/youfak/qinglong-bak into develop
This commit is contained in:
		
						commit
						43d76d5c8d
					
				|  | @ -423,11 +423,11 @@ export function psTree(pid: number): Promise<number[]> { | ||||||
| 
 | 
 | ||||||
| export async function killTask(pid: number) { | export async function killTask(pid: number) { | ||||||
|   const pids = await psTree(pid); |   const pids = await psTree(pid); | ||||||
|   // SIGINT 2 程序终止(interrupt)信号,不会打印额外信息
 | 
 | ||||||
|   if (pids.length) { |   if (pids.length) { | ||||||
|     try { |     try { | ||||||
|       [pid, ...pids].forEach((x) => { |       [pid, ...pids].reverse().forEach((x) => { | ||||||
|         process.kill(x, 2); |         process.kill(x, 15); | ||||||
|       }); |       }); | ||||||
|     } catch (error) { } |     } catch (error) { } | ||||||
|   } else { |   } else { | ||||||
|  |  | ||||||
|  | @ -241,6 +241,8 @@ main() { | ||||||
|   fi |   fi | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| handle_task_before "$@" | handle_task_start "$@" | ||||||
|  | run_task_before "$@" | ||||||
| main "$@" | main "$@" | ||||||
| handle_task_after "$@" | run_task_after "$@" | ||||||
|  | handle_task_end "$@" | ||||||
|  |  | ||||||
|  | @ -416,7 +416,7 @@ init_nginx() { | ||||||
|     location_url="^~${ql_base_url%*/}" |     location_url="^~${ql_base_url%*/}" | ||||||
|     aliasStr="alias ${dir_static}/dist;" |     aliasStr="alias ${dir_static}/dist;" | ||||||
|     if ! grep -q "<base href=\"$ql_base_url\">" "${dir_static}/dist/index.html"; then |     if ! grep -q "<base href=\"$ql_base_url\">" "${dir_static}/dist/index.html"; then | ||||||
|       awk -v text="<base href=\"$ql_base_url\">" '/<link/ && !inserted {print text; inserted=1} 1' "${dir_static}/dist/index.html" > temp.html |       awk -v text="<base href=\"$ql_base_url\">" '/<link/ && !inserted {print text; inserted=1} 1' "${dir_static}/dist/index.html" >temp.html | ||||||
|       mv temp.html "${dir_static}/dist/index.html" |       mv temp.html "${dir_static}/dist/index.html" | ||||||
|     fi |     fi | ||||||
|   else |   else | ||||||
|  | @ -438,11 +438,12 @@ init_nginx() { | ||||||
|   sed -i "s,IPV4_CONFIG,${ipv4Str},g" /etc/nginx/conf.d/front.conf |   sed -i "s,IPV4_CONFIG,${ipv4Str},g" /etc/nginx/conf.d/front.conf | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| handle_task_before() { | handle_task_start() { | ||||||
|   [[ $ID ]] && update_cron "\"$ID\"" "0" "$$" "$log_path" "$begin_timestamp" |   [[ $ID ]] && update_cron "\"$ID\"" "0" "$$" "$log_path" "$begin_timestamp" | ||||||
| 
 |  | ||||||
|   echo -e "## 开始执行... $begin_time\n" |   echo -e "## 开始执行... $begin_time\n" | ||||||
|  | } | ||||||
| 
 | 
 | ||||||
|  | run_task_before() { | ||||||
|   [[ $is_macos -eq 0 ]] && check_server |   [[ $is_macos -eq 0 ]] && check_server | ||||||
| 
 | 
 | ||||||
|   . $file_task_before "$@" |   . $file_task_before "$@" | ||||||
|  | @ -454,7 +455,7 @@ handle_task_before() { | ||||||
|   fi |   fi | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| handle_task_after() { | run_task_after() { | ||||||
|   . $file_task_after "$@" |   . $file_task_after "$@" | ||||||
| 
 | 
 | ||||||
|   if [[ $task_after ]]; then |   if [[ $task_after ]]; then | ||||||
|  | @ -462,7 +463,9 @@ handle_task_after() { | ||||||
|     eval "$task_after" |     eval "$task_after" | ||||||
|     echo -e "\n执行后置命令结束" |     echo -e "\n执行后置命令结束" | ||||||
|   fi |   fi | ||||||
|  | } | ||||||
| 
 | 
 | ||||||
|  | handle_task_end() { | ||||||
|   local etime=$(date "+$time_format") |   local etime=$(date "+$time_format") | ||||||
|   local end_time=$(format_time "$time_format" "$etime") |   local end_time=$(format_time "$time_format" "$etime") | ||||||
|   local end_timestamp=$(format_timestamp "$time_format" "$etime") |   local end_timestamp=$(format_timestamp "$time_format" "$etime") | ||||||
|  | @ -471,7 +474,6 @@ handle_task_after() { | ||||||
|   [[ "$diff_time" == 0 ]] && diff_time=1 |   [[ "$diff_time" == 0 ]] && diff_time=1 | ||||||
| 
 | 
 | ||||||
|   echo -e "\n## 执行结束... $end_time  耗时 $diff_time 秒     " |   echo -e "\n## 执行结束... $end_time  耗时 $diff_time 秒     " | ||||||
| 
 |  | ||||||
|   [[ $ID ]] && update_cron "\"$ID\"" "1" "" "$log_path" "$begin_timestamp" "$diff_time" |   [[ $ID ]] && update_cron "\"$ID\"" "1" "" "$log_path" "$begin_timestamp" "$diff_time" | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -7,7 +7,7 @@ dir_shell=$QL_DIR/shell | ||||||
| 
 | 
 | ||||||
| trap "single_hanle" 2 3 20 15 14 19 1 | trap "single_hanle" 2 3 20 15 14 19 1 | ||||||
| single_hanle() { | single_hanle() { | ||||||
|   eval handle_task_after "$@" "$cmd" |   eval handle_task_end "$@" "$cmd" | ||||||
|   exit 1 |   exit 1 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -156,7 +156,10 @@ const CronModal = ({ | ||||||
|           rules={[ |           rules={[ | ||||||
|             { |             { | ||||||
|               validator(rule, value) { |               validator(rule, value) { | ||||||
|                 if (value.includes(' task ') || value.startsWith('task ')) { |                 if ( | ||||||
|  |                   value && | ||||||
|  |                   (value.includes(' task ') || value.startsWith('task ')) | ||||||
|  |                 ) { | ||||||
|                   return Promise.reject(intl.get('不能包含 task 命令')); |                   return Promise.reject(intl.get('不能包含 task 命令')); | ||||||
|                 } |                 } | ||||||
|                 return Promise.resolve(); |                 return Promise.resolve(); | ||||||
|  | @ -181,7 +184,10 @@ const CronModal = ({ | ||||||
|           rules={[ |           rules={[ | ||||||
|             { |             { | ||||||
|               validator(rule, value) { |               validator(rule, value) { | ||||||
|                 if (value.includes(' task ') || value.startsWith('task ')) { |                 if ( | ||||||
|  |                   value && | ||||||
|  |                   (value.includes(' task ') || value.startsWith('task ')) | ||||||
|  |                 ) { | ||||||
|                   return Promise.reject(intl.get('不能包含 task 命令')); |                   return Promise.reject(intl.get('不能包含 task 命令')); | ||||||
|                 } |                 } | ||||||
|                 return Promise.resolve(); |                 return Promise.resolve(); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 child
						child