mirror of
https://github.com/juewuy/ShellCrash.git
synced 2026-03-10 23:41:22 +00:00
Merge branch 'master' into dev
# Conflicts: # ShellCrash.tar.gz # bin/version # version
This commit is contained in:
@@ -133,7 +133,7 @@ if [ "$systype" = "mi_snapshot" -o "$systype" = "ng_snapshot" ]; then
|
||||
chmod 755 "$CRASHDIR"/starts/snapshot_init.sh
|
||||
if [ "$systype" = "mi_snapshot" ];then
|
||||
path="/data/shellcrash_init.sh"
|
||||
setconfig CRASHDIR "$CRASHDIR" "$CRASHDIR"/starts/snapshot_init.sh
|
||||
sed -i "s#^CRASHDIR=.*#CRASHDIR=$CRASHDIR#" "$CRASHDIR"/starts/snapshot_init.sh
|
||||
mv -f "$CRASHDIR"/starts/snapshot_init.sh "$path"
|
||||
[ ! -f /data/auto_start.sh ] && echo '#用于自定义需要开机启动的功能或者命令,会在开机后自动运行' > /data/auto_start.sh
|
||||
else
|
||||
|
||||
@@ -26,7 +26,7 @@ web_save() { #最小化保存面板节点选择
|
||||
. "$CRASHDIR"/libs/compare.sh && compare "$TMPDIR/$file" "$CRASHDIR/configs/$file"
|
||||
[ "$?" = 0 ] && rm -f "$TMPDIR/$file" || mv -f "$TMPDIR/$file" "$CRASHDIR/configs/$file"
|
||||
else
|
||||
rm -f "$CRASHDIR/configs/$file" #空文件时移除旧文件
|
||||
> "$CRASHDIR/configs/$file" #空文件时移除旧文件
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
@@ -47,8 +47,8 @@ start)
|
||||
/etc/init.d/shellcrash start
|
||||
elif [ "$USER" = "root" ] && grep -q 'systemd' /proc/1/comm; then
|
||||
FragmentPath=$(systemctl show -p FragmentPath shellcrash | sed 's/FragmentPath=//')
|
||||
[ -f $FragmentPath ] && {
|
||||
setconfig ExecStart "$COMMAND >/dev/null" "$FragmentPath"
|
||||
[ -f "$FragmentPath" ] && {
|
||||
sed -i "s#^ExecStart=.*#ExecStart=$COMMAND >/dev/null#" "$FragmentPath"
|
||||
systemctl daemon-reload
|
||||
}
|
||||
systemctl start shellcrash.service || . "$CRASHDIR"/starts/start_error.sh
|
||||
|
||||
@@ -57,10 +57,12 @@ auto_clean(){
|
||||
}
|
||||
auto_start(){
|
||||
#设置init.d服务
|
||||
[ ! -x /etc/init.d/shellcrash ] && {
|
||||
cp -f "$CRASHDIR"/starts/shellcrash.procd /etc/init.d/shellcrash
|
||||
chmod 755 /etc/init.d/shellcrash
|
||||
}
|
||||
#初始化环境变量
|
||||
. "$CRASHDIR"/libs/set_profile.sh && set_profile '/etc/profile'
|
||||
grep -q '^export CRASHDIR=' '/etc/profile' && . "$CRASHDIR"/libs/set_profile.sh && set_profile '/etc/profile'
|
||||
#启动服务
|
||||
if [ ! -f "$CRASHDIR"/.dis_startup ]; then
|
||||
#AX6S/AX6000修复tun功能
|
||||
@@ -70,13 +72,9 @@ auto_start(){
|
||||
#自动覆盖根证书文件
|
||||
[ -s "$CRASHDIR"/tools/ca-certificates.crt ] && cp -f "$CRASHDIR"/tools/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
||||
#启动服务
|
||||
"$CRASHDIR"/start.sh start
|
||||
/etc/init.d/shellcrash enable
|
||||
"$CRASHDIR"/start.sh stop
|
||||
/etc/init.d/shellcrash start && /etc/init.d/shellcrash enable
|
||||
fi
|
||||
#启动自定义服务
|
||||
[ -s /data/auto_start.sh ] && /bin/sh /data/auto_start.sh &
|
||||
#兼容auto_ssh脚本
|
||||
[ -s /data/auto_ssh/auto_ssh.sh ] && /bin/sh /data/auto_ssh/auto_ssh.sh &
|
||||
}
|
||||
init(){
|
||||
#等待启动完成
|
||||
@@ -85,7 +83,11 @@ init(){
|
||||
done
|
||||
autoSSH #软固化功能
|
||||
auto_clean #自动清理
|
||||
[ -s "$CRASHDIR"/start.sh ] && [ ! -x /etc/init.d/shellcrash ] && auto_start
|
||||
auto_start
|
||||
#启动自定义服务
|
||||
[ -s /data/auto_start.sh ] && /bin/sh /data/auto_start.sh &
|
||||
#兼容auto_ssh脚本
|
||||
[ -s /data/auto_ssh/auto_ssh.sh ] && /bin/sh /data/auto_ssh/auto_ssh.sh &
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
|
||||
Reference in New Issue
Block a user