mirror of
https://github.com/wnlen/clash-for-linux.git
synced 2025-05-22 20:04:45 +08:00
optimit start.sh, add --skip-download-config and --skip-edit-profile to skip procedures
This commit is contained in:
parent
09aff5c6e5
commit
551f8c50a9
25
shutdown.sh
25
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
|
||||
|
||||
# 清除环境变量
|
||||
> /etc/profile.d/clash.sh
|
||||
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`
|
||||
|
|
Loading…
Reference in New Issue
Block a user