猫盘plus 群晖 完美关机脚本(三合一修复脚本)

此前安装了群晖 DSM 6.2,按网上方法折腾了几个方案都不成功。

于是把系统升级为 DSM 7.01 , 按网上的方法成功了。

脚本内容:

bash 复制代码
#!/bin/sh

fixhosts(){
cat > /etc/hosts << \EOF
127.0.0.1	localhost
::1		localhost
127.0.0.1	DS120j
::1		DS120j

52.84.166.71 api.themoviedb.org
52.84.166.68 api.themoviedb.org
18.65.159.31 api.themoviedb.org
13.35.0.128 api.themoviedb.org
99.84.238.181 image.tmdb.org
13.226.254.58 image.tmdb.org
65.8.164.121 image.tmdb.org
54.192.73.28 image.tmdb.org
EOF
}

rc_local_func(){
if [ "$1" = "120bak" ]; then
  rm /etc/rc.local
  if [ -f /etc/rc.local.bak ]; then
    mv -f /etc/rc.local.bak /etc/rc.local
  fi
else
  if [ -f /etc/rc.local ]; then
    mv -f /etc/rc.local /etc/rc.local.bak
  fi
  cat > /etc/rc.local << \EOF
#!/bin/sh
if [ "$1" = "R" ]
then
i2cset -y -f 0 0x45 0x00 0x55
i2cset -y -f 0 0x45 0x01 0x01
i2cset -y -f 0 0x45 0x31 0x03
i2cset -y -f 0 0x45 0x32 0x03
i2cset -y -f 0 0x45 0x33 0x03
i2cset -y -f 0 0x45 0x30 0x07
i2cset -y -f 0 0x45 0x34 128
i2cset -y -f 0 0x45 0x35 0
i2cset -y -f 0 0x45 0x36 0

killall -9 synoscsitmonitor
sleep 60
/usr/sbin/ntpdate -u ntp1.aliyun.com
systemctl stop pkg-scsit-monitor.service

fi

if [ "$1" = "G" ]
then
i2cset -y -f 0 0x45 0x00 0x55
i2cset -y -f 0 0x45 0x01 0x01
i2cset -y -f 0 0x45 0x31 0x03
i2cset -y -f 0 0x45 0x32 0x03
i2cset -y -f 0 0x45 0x33 0x03
i2cset -y -f 0 0x45 0x30 0x07
i2cset -y -f 0 0x45 0x34 0
i2cset -y -f 0 0x45 0x35 128
i2cset -y -f 0 0x45 0x36 0

killall -9 synoscsitmonitor
sleep 60
/usr/sbin/ntpdate -u ntp1.aliyun.com
systemctl stop pkg-scsit-monitor.service

fi

if [ "$1" = "B" ]
then
i2cset -y -f 0 0x45 0x00 0x55
i2cset -y -f 0 0x45 0x01 0x01
i2cset -y -f 0 0x45 0x31 0x03
i2cset -y -f 0 0x45 0x32 0x03
i2cset -y -f 0 0x45 0x33 0x03
i2cset -y -f 0 0x45 0x30 0x07
i2cset -y -f 0 0x45 0x34 0
i2cset -y -f 0 0x45 0x35 0
i2cset -y -f 0 0x45 0x36 128

killall -9 synoscsitmonitor
sleep 60
/usr/sbin/ntpdate -u ntp1.aliyun.com
systemctl stop pkg-scsit-monitor.service

fi

if [ "$1" = "W" ]
then
i2cset -y -f 0 0x45 0x00 0x55
i2cset -y -f 0 0x45 0x01 0x01
i2cset -y -f 0 0x45 0x31 0x03
i2cset -y -f 0 0x45 0x32 0x03
i2cset -y -f 0 0x45 0x33 0x03
i2cset -y -f 0 0x45 0x30 0x07
i2cset -y -f 0 0x45 0x34 128
i2cset -y -f 0 0x45 0x35 128
i2cset -y -f 0 0x45 0x36 128

killall -9 synoscsitmonitor
sleep 60
/usr/sbin/ntpdate -u ntp1.aliyun.com
systemctl stop pkg-scsit-monitor.service

fi

if [ "$1" = "" ]
then
i2cset -y -f 0 0x45 0x00 0x55
i2cset -y -f 0 0x45 0x01 0x01
i2cset -y -f 0 0x45 0x30 0x07
        
i2cset -y -f 0 0x45 0x31 0x72
i2cset -y -f 0 0x45 0x32 0x72
i2cset -y -f 0 0x45 0x33 0x72
        
i2cset -y -f 0 0x45 0x37 0x44  
i2cset -y -f 0 0x45 0x3a 0x55
i2cset -y -f 0 0x45 0x3d 0x66      

i2cset -y -f 0 0x45 0x38 0x44
i2cset -y -f 0 0x45 0x3b 0x55
i2cset -y -f 0 0x45 0x3e 0x66
i2cset -y -f 0 0x45 0x39 0x40
i2cset -y -f 0 0x45 0x3c 0x40
i2cset -y -f 0 0x45 0x3f 0x40

i2cset -y -f 0 0x45 0x34 128
i2cset -y -f 0 0x45 0x35 128
i2cset -y -f 0 0x45 0x36 128

killall -9 synoscsitmonitor
sleep 60
/usr/sbin/ntpdate -u ntp1.aliyun.com
systemctl stop pkg-scsit-monitor.service

fi

if [ "$1" = "X" ]
then
i2cset -y -f 0 0x45 0x00 0x55

killall -9 synoscsitmonitor
sleep 60
/usr/sbin/ntpdate -u ntp1.aliyun.com
systemctl stop pkg-scsit-monitor.service

fi

EOF
  if [ "$1" = "120x" ]; then
    cat >> /etc/rc.local << \EOF
if [ "$1" = "K" ]
then
/usr/bin/systemctl --force poweroff
i2cset -y -f 0 0x45 0x00 0x55
i2cset -y -f 0 0x45 0x01 0x01
i2cset -y -f 0 0x45 0x31 0x33
i2cset -y -f 0 0x45 0x32 0x33
i2cset -y -f 0 0x45 0x33 0x33
i2cset -y -f 0 0x45 0x30 0x07
i2cset -y -f 0 0x45 0x34 128
i2cset -y -f 0 0x45 0x35 0
i2cset -y -f 0 0x45 0x36 0
fi
EOF
  fi
  if [ "$1" = "120d" ]; then
    cat >> /etc/rc.local << \EOF
if [ "$1" = "K" ]
then
i2cset -y -f 0 0x45 0x77 0xc6
sleep 1
reboot
fi
EOF
  fi
  chmod 755 /etc/rc.local
fi
}

if [ "$1" = "" ]
then
  echo -e "\e[1;33m 如果一直失败,可能是引导方式不同,请另寻高明。  \e[0m"
  echo -e "\e[1;31m =================== LonelyGod =================== \e[0m"
  echo -e "\e[1;31m |                                               | \e[0m"
  echo -e "\e[1;31m |          猫盘群晖DSM7.0三合一修复脚本         | \e[0m"
  echo -e "\e[1;31m |                                               | \e[0m"
  echo -e "\e[1;31m ================= https://hin.cool ================= \e[0m"
  echo -e "\e[1;33m             bash bug 120x/120d/120bak             \e[0m"
fi

if [ "$1" = "120x" -o "$1" = "120d" ]; then
  echo -e "\e[1;33m 如果一直失败,可能是引导方式不同,请另寻高明。  \e[0m"
  echo -e "\e[1;31m =================== LonelyGod =================== \e[0m"
  echo -e "\e[1;31m |                                               | \e[0m"
  echo -e "\e[1;31m |          猫盘群晖DSM7.0三合一修复脚本         | \e[0m"
  echo -e "\e[1;31m |                                               | \e[0m"
  echo -e "\e[1;31m ================= https://hin.cool ================= \e[0m"
  rc_local_func $1
  fixhosts
  rm -rf /var/log/*

  sed -i 's#/dev/null#/tmp/scemd.log#g' /etc.defaults/syslog-ng/patterndb.d/scemd.conf
  sed -i 's#/dev/null#/tmp/postgresql.log#g' /etc.defaults/syslog-ng/patterndb.d/postgresql.conf
  sed -i 's#/var/log/scemd.log#/tmp/scemd.log#g' /etc.defaults/syslog-ng/patterndb.d/scemd.conf
  sed -i 's#/var/log/postgresql.log#/tmp/postgresql.log#g' /etc.defaults/syslog-ng/patterndb.d/postgresql.conf
  sed -i 's#/usr/bin/systemctl --force poweroff#/etc/rc.local K#g' /usr/lib/systemd/system/systemd-poweroff.service

  sed -i 's/buzzeroffcfg="0x00"/buzzeroffcfg="0x1b"/g' /etc.defaults/synoinfo.conf
  sed -i 's/enable_fan_debug="0x0"/enable_fan_debug="no"/g' /etc.defaults/synoinfo.conf
  sed -i 's/support_auto_poweron="yes"/support_auto_poweron="no"/g' /etc.defaults/synoinfo.conf
  sed -i 's/support_buzzer="yes"/support_buzzer="no"/g' /etc.defaults/synoinfo.conf
  sed -i 's/support_fan="yes"/support_fan="no"/g' /etc.defaults/synoinfo.conf
  sed -i 's/support_fan_adjust_dual_mode="yes"/support_fan_adjust_dual_mode="no"/g' /etc.defaults/synoinfo.conf
  sed -i 's/support_led_behavior_v2="yes"/support_led_behavior_v2="no"/g' /etc.defaults/synoinfo.conf
  sed -i 's/support_power_recovery="yes"/support_power_recovery="no"/g' /etc.defaults/synoinfo.conf
  sed -i 's/support_wol="yes"/support_wol="no"/g' /etc.defaults/synoinfo.conf
  sed -i 's/supportrcpower="yes"/supportrcpower="no"/g' /etc.defaults/synoinfo.conf
  sed -i 's/supportsystemperature="yes"/supportsystemperature="no"/g' /etc.defaults/synoinfo.conf
  sed -i 's/supportsystempwarning="yes"/supportsystempwarning="no"/g' /etc.defaults/synoinfo.conf
  echo -e "\e[1;33m 成功啦!成功啦!成功啦!立即重启猫盘,Enjoy  it!  \e[0m"
  rm -f /root/bug
  i2cset -y -f 0 0x45 0x00 0x55
  i2cset -y -f 0 0x45 0x01 0x01
  i2cset -y -f 0 0x45 0x31 0x33
  i2cset -y -f 0 0x45 0x32 0x33
  i2cset -y -f 0 0x45 0x33 0x33
  i2cset -y -f 0 0x45 0x30 0x07
  i2cset -y -f 0 0x45 0x34 0
  i2cset -y -f 0 0x45 0x35 128
  i2cset -y -f 0 0x45 0x36 0
fi

if [ "$1" = "120bak" ]; then
  echo -e "\e[1;33m 如果一直失败,可能是引导方式不同,请另寻高明。  \e[0m"
  echo -e "\e[1;31m =================== LonelyGod =================== \e[0m"
  echo -e "\e[1;31m |                                               | \e[0m"
  echo -e "\e[1;31m |          猫盘群晖DSM7.0三合一修复脚本         | \e[0m"
  echo -e "\e[1;31m |                                               | \e[0m"
  echo -e "\e[1;31m ================= https://hin.cool ================= \e[0m"

  rc_local_func $1
  rm -rf /var/log/*

  sed -i 's#/dev/null#/var/log/scemd.log#g' /etc.defaults/syslog-ng/patterndb.d/scemd.conf
  sed -i 's#/dev/null#/var/log/postgresql.log#g' /etc.defaults/syslog-ng/patterndb.d/postgresql.conf
  sed -i 's#/tmp/scemd.log#/var/log/scemd.log#g' /etc.defaults/syslog-ng/patterndb.d/scemd.conf
  sed -i 's#/tmp/postgresql.log#/var/log/postgresql.log#g' /etc.defaults/syslog-ng/patterndb.d/postgresql.conf
  sed -i 's#/etc/rc.local K#/usr/bin/systemctl --force poweroff#g' /usr/lib/systemd/system/systemd-poweroff.service

  sed -i 's/buzzeroffcfg="0x1b"/buzzeroffcfg="0x00"/g' /etc.defaults/synoinfo.conf
  sed -i 's/enable_fan_debug="no"/enable_fan_debug="0x0"/g' /etc.defaults/synoinfo.conf
  sed -i 's/support_auto_poweron="no"/support_auto_poweron="yes"/g' /etc.defaults/synoinfo.conf
  sed -i 's/support_buzzer="no"/support_buzzer="yes"/g' /etc.defaults/synoinfo.conf
  sed -i 's/support_fan="no"/support_fan="yes"/g' /etc.defaults/synoinfo.conf
  sed -i 's/support_fan_adjust_dual_mode="no"/support_fan_adjust_dual_mode="yes"/g' /etc.defaults/synoinfo.conf
  sed -i 's/support_led_behavior_v2="no"/support_led_behavior_v2="yes"/g' /etc.defaults/synoinfo.conf
  sed -i 's/support_power_recovery="no"/support_power_recovery="yes"/g' /etc.defaults/synoinfo.conf
  sed -i 's/support_wol="no"/support_wol="yes"/g' /etc.defaults/synoinfo.conf
  sed -i 's/supportrcpower="no"/supportrcpower="yes"/g' /etc.defaults/synoinfo.conf
  sed -i 's/supportsystemperature="no"/supportsystemperature="yes"/g' /etc.defaults/synoinfo.conf
  sed -i 's/supportsystempwarning="no"/supportsystempwarning="yes"/g' /etc.defaults/synoinfo.conf
  echo -e "\e[1;33m 成功啦!成功啦!成功啦!立即重启猫盘,Enjoy  it!  \e[0m"
  rm -f /root/bug
  i2cset -y -f 0 0x45 0x00 0x55
  i2cset -y -f 0 0x45 0x01 0x01
  i2cset -y -f 0 0x45 0x31 0x33
  i2cset -y -f 0 0x45 0x32 0x33
  i2cset -y -f 0 0x45 0x33 0x33
  i2cset -y -f 0 0x45 0x30 0x07
  i2cset -y -f 0 0x45 0x34 0
  i2cset -y -f 0 0x45 0x35 128
  i2cset -y -f 0 0x45 0x36 0
fi
/usr/bin/systemctl daemon-reload

1、保存为: bug.sh

(注意,保存的时候需要把Windows 风格的换行符(\r\n),换成Unix/Linux 使用的换行符(\n),

1)、在VS Code窗口的右下角,你会看到当前文件的换行符类型,可能显示为 CRLF(Windows 风格换行符)或 LF(Unix 风格换行符)。

2)、点击 CRLF,会弹出一个菜单,选择 LF。

3)、保存文件

2、在猫盘中创建一个共享文件夹:ds120share (这个文件夹在linux中访问的路径是/volume1/ds120share/)

3、把 bug.sh 复制到猫盘的ds120share文件夹中

4、通过putty连上猫盘

5、将 /volume1/ds120share/bug.sh 复制到 /root/ 目录:

bash 复制代码
cp /volume1/ds120share/bug.sh /root/bug.sh

6、修改文件权限

bash 复制代码
chmod +x /root/bug.sh

7、运行脚本,并传递 120d 参数:

bash 复制代码
bash /root/bug.sh 120d

执行后猫盘的灯慢闪橙色。

8、在群晖界面中重启猫盘 --> 重启后在群晖界面中"关机"-->成功!

参考:猫盘群晖DSM7.0三合一修复脚本_猫盘掉ip修复脚本-CSDN博客

猫盘群晖DSM7.0三合一修复 | 瓦解的生活记事

相关推荐
WolvenSec2 小时前
网络基础:EIGRP
运维·网络·安全·智能路由器
踩着阴暗的自己向上爬3 小时前
Day05-04-持续集成总结
linux·运维·ci/cd
qyhua4 小时前
Linux内网端口转公网端口映射
linux·运维·服务器
开开心心kai4 小时前
如何快速申请免费SSL证书,实现网站HTTPS安全传输
网络·网络协议·安全·https·ssl
Geeker554 小时前
如何在忘记密码的情况下解锁Android手机?
android·网络·macos·华为·智能手机·电脑·手机
j.king5 小时前
开源GTKSystem.Windows.Forms框架让C# winform支持跨平台运行
linux·c#·gtk
stackY、6 小时前
【Linux】:程序地址空间
linux·算法
starleeisamyth7 小时前
Ubuntu + SSH密钥连接服务器
服务器·ubuntu·ssh
这是另一个世界7 小时前
黑客技术大纲
网络·学习·web安全·网络安全
国中之林7 小时前
【qt】如何获取本机的IP地址?
服务器·qt·网络协议·学习·tcp/ip