diff --git a/bin/ShellCrash.tar.gz b/bin/ShellCrash.tar.gz index 208295d..ead3dbc 100644 Binary files a/bin/ShellCrash.tar.gz and b/bin/ShellCrash.tar.gz differ diff --git a/bin/clashfm.tar.gz b/bin/clashfm.tar.gz index 8dbf9db..1cc8923 100644 Binary files a/bin/clashfm.tar.gz and b/bin/clashfm.tar.gz differ diff --git a/bin/public.tar.gz b/bin/public.tar.gz index 1f1864e..4be8543 100644 Binary files a/bin/public.tar.gz and b/bin/public.tar.gz differ diff --git a/bin/version b/bin/version index 31be3c0..5fceec1 100644 --- a/bin/version +++ b/bin/version @@ -5,4 +5,4 @@ meta_v=v1.18.0 singbox_v=1.7.8 GeoIP_v=20240120 -versionsh=1.8.8f +versionsh=1.8.8g diff --git a/scripts/init.sh b/scripts/init.sh index f8437b8..ee1443b 100644 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -1,7 +1,7 @@ #!/bin/sh # Copyright (C) Juewuy -version=1.8.8f +version=1.8.8g setdir(){ dir_avail(){ @@ -160,13 +160,13 @@ else [ -w /etc/systemd/system ] && sysdir=/etc/systemd/system if [ -n "$sysdir" -a "$USER" = "root" -a "$(cat /proc/1/comm)" = "systemd" ];then #创建shellcrash用户并赋予root权限 + sed -i '/0:7890/d' /etc/passwd if type userdel useradd groupmod; then userdel shellcrash 2>/dev/null useradd shellcrash -u 7890 2>/dev/null - groupmod shellcrash -g 7890 + groupmod shellcrash -g 7890 2>/dev/null sed -Ei s/7890:7890/0:7890/g /etc/passwd else - sed -i '/0:7890/d' /etc/passwd echo "shellcrash:x:0:7890::/home/shellcrash:/bin/sh" >> /etc/passwd fi #配置systemd diff --git a/scripts/start.sh b/scripts/start.sh index beb403d..6199a6f 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -1512,6 +1512,8 @@ bfstart(){ #启动前 [ -z "$update_url" ] && update_url=https://fastly.jsdelivr.net/gh/juewuy/ShellCrash@master [ ! -d ${BINDIR}/ui ] && mkdir -p ${BINDIR}/ui [ -z "$crashcore" ] && crashcore=clash + #执行条件任务 + [ -s ${CRASHDIR}/task/bfstart ] && source ${CRASHDIR}/task/bfstart #检查内核配置文件 if [ ! -f $core_config ];then if [ -n "$Url" -o -n "$Https" ];then @@ -1555,8 +1557,6 @@ bfstart(){ #启动前 fi #清理debug日志 rm -rf ${TMPDIR}/debug.log - #执行条件任务 - [ -s ${CRASHDIR}/task/bfstart ] && source ${CRASHDIR}/task/bfstart return 0 } afstart(){ #启动后 @@ -1649,7 +1649,7 @@ start_old(){ #保守模式 $nohup $COMMAND &>/dev/null & fi afstart - cronset '保守模式守护进程' "* * * * * test -z \"\$(pidof CrashCore)\" && ${CRASHDIR}/start.sh start #ShellCrash保守模式守护进程" + cronset '保守模式守护进程' "* * * * * test -z \"\$(pidof CrashCore)\" && ${CRASHDIR}/start.sh daemon #ShellCrash保守模式守护进程" } #杂项 update_config(){ #更新订阅并重启 @@ -1723,6 +1723,10 @@ restart) $0 stop $0 start ;; +daemon) + [ ! -f $TMPDIR/crash_start_time ] && sleep 20 + $0 start + ;; debug) [ -n "$(pidof CrashCore)" ] && $0 stop >/dev/null #禁止多实例 getconfig diff --git a/scripts/task.sh b/scripts/task.sh index af741db..a51ee69 100644 --- a/scripts/task.sh +++ b/scripts/task.sh @@ -198,7 +198,7 @@ task_user_add(){ #自定义命令添加 task_command=$script echo -e "请检查输入:\033[32m$task_command\033[0m" #获取本任务ID - task_max_id=$(awk -F'#' '{print $1}' ${CRASHDIR}/task/task.user | sort -n | tail -n 1) + task_max_id=$(awk -F '#' '{print $1}' ${CRASHDIR}/task/task.user 2>/dev/null | sort -n | tail -n 1) [ -z "$task_max_id" ] && task_max_id=200 task_id=$((task_max_id + 1)) read -p "请输入任务备注 > " txt @@ -233,8 +233,6 @@ task_add(){ #任务添加 echo ----------------------------------------------- echo -e "\033[36m请选择需要添加的任务\033[0m" echo ----------------------------------------------- - #检测并创建自定义任务文件 - [ -f ${CRASHDIR}/task/task.user ] || echo '#任务ID(必须>200并顺序排列)#任务命令#任务说明(#号隔开,任务命令和说明中都不允许包含#号)' > ${CRASHDIR}/task/task.user #输出任务列表 cat ${CRASHDIR}/task/task.list ${CRASHDIR}/task/task.user 2>/dev/null | grep -Ev '^(#|$)' | awk -F '#' '{print " "NR" "$3}' echo ----------------------------------------------- @@ -468,6 +466,8 @@ task_recom(){ #任务推荐 } } task_menu(){ #任务菜单 + #检测并创建自定义任务文件 + [ -f ${CRASHDIR}/task/task.user ] || echo '#任务ID(必须>200并顺序排列)#任务命令#任务说明(#号隔开,任务命令和说明中都不允许包含#号)' > ${CRASHDIR}/task/task.user echo ----------------------------------------------- echo -e "\033[30;47m欢迎使用自动任务功能:\033[0m" echo -----------------------------------------------