mirror of
				https://github.com/wnlen/clash-for-linux.git
				synced 2025-11-01 03:31:30 +08:00 
			
		
		
		
	optimit start.sh, add --skip-download-config and --skip-edit-profile to skip procedures
This commit is contained in:
		
							
								
								
									
										23
									
								
								shutdown.sh
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								shutdown.sh
									
									
									
									
									
								
							| @ -1,5 +1,22 @@ | ||||
| #!/bin/bash | ||||
|  | ||||
| # 初始化跳过编辑profile标志 | ||||
| SKIP_EDIT_PROFILE=false | ||||
|  | ||||
| # 处理命令行参数 | ||||
| while [[ $# -gt 0 ]]; do | ||||
|     case $1 in | ||||
|         --skip-edit-profile) | ||||
|             SKIP_EDIT_PROFILE=true | ||||
|             shift | ||||
|             ;; | ||||
|         *) | ||||
|             echo "未知参数: $1" | ||||
|             exit 1 | ||||
|             ;; | ||||
|     esac | ||||
| done | ||||
|  | ||||
| # 关闭clash服务 | ||||
| PID_NUM=`ps -ef | grep [c]lash-linux-a | wc -l` | ||||
| PID=`ps -ef | grep [c]lash-linux-a | awk '{print $2}'` | ||||
| @ -9,7 +26,13 @@ if [ $PID_NUM -ne 0 ]; then | ||||
| fi | ||||
|  | ||||
| # 清除环境变量 | ||||
| if [ "$SKIP_EDIT_PROFILE" = false ]; then | ||||
|     if [ "$(id -u)" -eq 0 ]; then | ||||
|         > /etc/profile.d/clash.sh | ||||
|     else | ||||
|         echo "错误:需要 root 权限才能修改 /etc/profile.d/clash.sh" >&2 | ||||
|     fi | ||||
| fi | ||||
|  | ||||
| # 检查并关闭系统托盘图标 | ||||
| PID_NUM=`ps -ef | grep [y]ad | grep -i clash | wc -l` | ||||
|  | ||||
		Reference in New Issue
	
	Block a user