扫描二维码关注官方公众号
返回列表 发布新帖

[玩法/技巧] APC Back-UPS650+群晖,市电断电进入安全模式不关机问题解决

 火...

评论740

allurelovellLv.1 发表于 2021-5-6 00:09:40 | 显示全部楼层
感谢分享。。。。。。。。。。。。。。。。。。。。
回复 点赞

使用道具 举报

gebokongqi123Lv.4 发表于 2021-5-6 00:39:03 | 显示全部楼层
前来学习,为了俺的硬盘
回复 点赞

使用道具 举报

fuyuccLv.1 发表于 2021-5-12 23:09:59 | 显示全部楼层
谢谢大神看看
回复 点赞

使用道具 举报

xiaodaolfLv.1 发表于 2021-5-13 11:42:33 | 显示全部楼层
学习了,谢谢!
回复 点赞

使用道具 举报

w120084179Lv.2 发表于 2021-6-9 18:52:20 | 显示全部楼层
学习下如何自动关机
回复 点赞

使用道具 举报

hehe9011Lv.3 发表于 2021-6-14 19:41:43 | 显示全部楼层
感谢分享!
回复 点赞

使用道具 举报

kkggssLv.2 发表于 2021-6-14 19:57:06 | 显示全部楼层
看看是什么办法看看是什么办法
回复 点赞

使用道具 举报

bingdimiLv.2 发表于 2021-6-14 21:05:58 | 显示全部楼层
感谢分享
回复 点赞

使用道具 举报

thang009Lv.2 发表于 2021-6-14 23:37:05 | 显示全部楼层
感谢分享
回复 点赞

使用道具 举报

lt123457Lv.1 发表于 2021-6-15 15:44:55 | 显示全部楼层
看看是怎么操作的
回复 点赞

使用道具 举报

lazylady77Lv.4 发表于 2021-6-27 11:49:36 | 显示全部楼层
求指教,回复可见。
回复 点赞

使用道具 举报

copyleftLv.1 发表于 2021-7-1 21:35:23 | 显示全部楼层
对版本有要求吗
回复 点赞

使用道具 举报

fineconeyLv.4 发表于 2021-7-5 19:44:36 | 显示全部楼层
打开群晖SSH功能这里就不讲了,可以百度一下,资料很多。
回复 点赞

使用道具 举报

yccsbbqLv.3 发表于 2021-7-21 08:44:33 | 显示全部楼层
我的好像也是这样
回复 点赞

使用道具 举报

旧时光影视Lv.1 发表于 2021-7-28 21:40:21 | 显示全部楼层
学习学习
回复 点赞

使用道具 举报

旧时光影视Lv.1 发表于 2021-7-28 22:24:10 | 显示全部楼层
. /usr/syno/bin/synoupscommon

if [ "x$1" = "x" -o "x$1" = "x-h" ]; then
    echo "Copyright (c) 2008-2020 Synology Inc. All rights reserved."
    echo "Usage: `basename $0` { online | lowbatt | nocomm | fsd }"
    exit
fi

UPSMode=`/bin/get_key_value $SYNOUPS_CONF ups_mode`
SYNOBOOTBIN="/usr/syno/bin/synobootseq"
case "${UPSMode}" in
[Ss][Nn][Mm][Pp] | [Uu][Ss][Bb])
    UPSMaster=1
    EnabledKey="ups_enabled"
    UPSMonServer="localhost"
    ;;
*)
    UPSMaster=0
    EnabledKey="upsslave_enabled"
    UPSMonServer=`/bin/get_key_value $SYNOUPS_CONF upsslave_server`
"synoups-back" 273L, 5696C               



我的群晖打开这个文件是这样的  没有你说的那些字符串嘛,求楼主解答
回复 点赞

使用道具 举报

旧时光影视Lv.1 发表于 2021-7-28 23:21:25 | 显示全部楼层
本帖最后由 旧时光影视 于 2021-7-28 23:45 编辑

我仔细的看了一下群晖6.2.3系统的synoups文件和7.0系统的文件    里面的语法也有所改变   所以不敢轻举妄动   7.0系统确实已经完全取消了“关机后同时关闭ups电源”这个选项,所以当断电后群晖只会进入到安全模式   不会关机,ups也不会关机    只有一直等ups电耗完为止 ,7.0系统有点鸡肋了   想尝试你这个方法让群晖主动关机不料synoups文件语法不懂,以下是7.0系统打开synoups的语法红色部分与你的不同不敢修改:

# Copyright (c) 2008-2010 Synology Inc. All rights reserved.

. /usr/syno/bin/synoupscommon

if [ "x$1" = "x" -o "x$1" = "x-h" ]; then
        echo "Copyright (c) 2008-2020 Synology Inc. All rights reserved."
        echo "Usage: `basename $0` { online | lowbatt | nocomm | fsd }"
        exit
fi

UPSMode=`/bin/get_key_value $SYNOUPS_CONF ups_mode`
SYNOBOOTBIN="/usr/syno/bin/synobootseq"
case "${UPSMode}" in
[Ss][Nn][Mm][Pp] | [Uu][Ss][Bb])
        UPSMaster=1
        EnabledKey="ups_enabled"
        UPSMonServer="localhost"
        ;;
*)
        UPSMaster=0
        EnabledKey="upsslave_enabled"
        UPSMonServer=`/bin/get_key_value $SYNOUPS_CONF upsslave_server`
        if [ "x$UPSMonServer" = "x" ]; then
                UPSMonServer="localhost"
        elif [ 0 -lt `echo ${UPSMonServer}|grep -c ':'` ]; then
                UPSMonServer="[${UPSMonServer}]"
        fi
        ;;
esac

UPSEnabled=`/bin/get_key_value $SYNOUPS_CONF ${EnabledKey}`
case "$UPSEnabled" in
[Yy][Ee][Ss])
        ;;
*)
        echo "UPS is not enable."
        exit
        ;;
esac

UPSSafeShutdown=`/bin/get_key_value $SYNOUPS_CONF ups_safeshutdown`
case "${UPSSafeShutdown}" in
[Nn][Oo])
        UPSSafeShutdown=0;;
[Yy][Ee][Ss])
        UPSSafeShutdown=1;;
*)
        UPSSafeShutdown=0;;
esac

SZF_SAFEMODE="/tmp/ups.safedown"
SZF_ONBATT="/tmp/ups.onbatt"

SynoUpsStateLog() {
        local ups_log_item="device.mfr device.model battery.charge battery.runtime battery.voltage input.voltage output.voltage ups.load ups.status"
        if [ $# -ge 1 ]; then
                logger -p user.err -t synoups $1
        fi
        logger -p user.err -t synoups "=====log UPS status start====="
        for item in $ups_log_item; do
                local upsc_result=`${BIN_UPSC} ups@${UPSMonServer} ${item}`
                logger -p user.err -t synoups "${item}=${upsc_result}"
        done
        logger -p user.err -t synoups "=====log UPS status end====="
}

SYSLOG() {
        logger -p user.err -t upsmsg "$1"
}

UPSStatusGet() {
        ups_stat=`${BIN_UPSC} ups@${UPSMonServer} ups.status 2>/dev/null`
        if [ $? -ne 0 ]; then
                echo "ERR"
                return 255
        fi
        for status in $ups_stat ; do
                case "$status" in
                "OL"|"OB"|"LB")
                        echo "$status"
                        return
                        ;;
                esac
        done
        echo "ERR"
}

UPSShutdown() {
        if [ $UPSMaster -ne 1 ]; then
                echo "Slave waits for safe shutdown" >> $SZF_SAFEMODE
                touch /var/.NormalShutdown
                SYSLOG "UPS waits for safe shutdown."
                return
        fi
        OL=0
        LB=0
        while [ $OL -ne 2 -a $LB -ne 2 ]; do
                sleep 10
                St=`UPSStatusGet`
                if [ "$St" = "OL" ]; then
                        OL=`expr $OL + 1`
                        LB=0
                else
                        LB=`expr $LB + 1`
                        OL=0
                fi
                echo "OL=$OL LB=$LB" >> $SZF_SAFEMODE
        done
        if [ $OL -eq 2 ]; then
                synologset1 sys warn 0x11300012
                echo "UPS back to On-Line and reboot." >> $SZF_SAFEMODE
                /sbin/reboot
        elif [ $LB -eq 2 ]; then
                touch /var/.NormalShutdown
                if [ $UPSSafeShutdown -eq 0 ]; then
                        echo "Waiting UPS exhausted." >> $SZF_SAFEMODE
                        SYSLOG "Waiting UPS exhausted."
                else
                        echo "UPS safe shutdown." >> $SZF_SAFEMODE
                        SYSLOG "UPS safe shutdown."

                        shutdown_retry=0
                        while [ $shutdown_retry -ne 3 ]; do
                                StopUps
                                /usr/bin/upsdrvctl shutdown
                                if [ $? -eq 0 ]; then
                                        return 0
                                fi
                                shutdown_retry=`expr $shutdown_retry + 1`
                                echo "UPS shutdown retry ... $shutdown_retry" >> $SZF_SAFEMODE
                                echo "UPS shutdown retry ... $shutdown_retry" > /dev/kmsg
                                # omron driver will reset usb (~30s) when command timeout
                                sleep 40
                        done
                        echo "UPS shutdown fail." >> $SZF_SAFEMODE
                        echo "UPS shutdown fail" > /dev/kmsg
                fi
        fi
}

UPSSafeMode() {
        if [ -f $SZF_SAFEMODE ]; then
                return
        fi

        $SYNOBOOTBIN --is-shutdown
        if [ $? -eq 0 ]; then
                SYSLOG "[UPS] System is shutting down. Ignore onbattery event."
                return
        fi

        SYSLOG "[UPS] Check Boot Status."
        $SYNOBOOTBIN --is-ready
        while [ $? -ne 0 ]
        do
                sleep 2
                $SYNOBOOTBIN --is-ready
        done

        St=`UPSStatusGet`
        if [ "$St" = "OL" ]; then
                SYSLOG "WARNING: UPS is On-Line"
                return
       fi
        echo "$1" > $SZF_SAFEMODE


        /usr/syno/bin/synologset1 sys warn 0x11300011
        SYSLOG "[UPS] Server is going to Safe Mode. It will stop all services and umount all volumes."(此处与楼主的不同,不敢修改)


        /usr/syno/sbin/synopoweroff -s &
}

UPSRestart() {
        if [ -f $SZF_ONBATT ]; then
                rm $SZF_ONBATT
                if [ ! -f $SZF_SAFEMODE ]; then
                        /usr/syno/bin/synologset1 sys info 0x11300012
                        /usr/syno/bin/synonotify UPSOnAC
                        SYSLOG "UPS back online, not in safe mode"
                fi
        fi
        if [ ! -f $SZF_SAFEMODE ]; then
                return
        fi
        echo "UPS back on-line, in safe mode, so wait to reboot" >> $SZF_SAFEMODE
        sleep 30
        St=`UPSStatusGet`
        timeout=$((3*60))

        if [ "$St" = "OL" ]; then
                SYSLOG "[UPS] Check Safe Mode Done."
                while [ "active" != "`synosystemctl get-active-status safe-shutdown.target`" ] && [ $timeout -gt 0 ]
                do
                        sleep 2
                        timeout=`expr $timeout - 2`
                done

                synologset1 sys warn 0x11300012
                SYSLOG "UPS back to On-Line and reboot."
                /sbin/reboot
        fi
}

ONBatt() {
        if [ ! -f $SZF_ONBATT ]; then
                touch $SZF_ONBATT
                SYSLOG "UPS on battery."
        fi
}

UPSLowBattCheck() {
        local Status=`UPSStatusGet`
        if [ "$Status" = "OL" ]; then
                return
        fi
        /usr/syno/bin/synonotify UPSPowerFail
        SYSLOG "UPS battery low"
}

UPSWaitTimeUp() {
        SYSLOG "UPS wait time up"
}

FLOCK_FILE="/tmp/synoups.lock"
{
flock -x 99

case "$1" in
online)
        SynoUpsStateLog "synoups online"
        UPSRestart
        ;;
onbatt)
        SynoUpsStateLog "synoups onbatt"
        ONBatt
        ;;
lowbatt)
        SynoUpsStateLog "synoups lowbatt"
        UPSLowBattCheck
        UPSSafeMode $1
        ;;
nocomm)
        SynoUpsStateLog "synoups nocomm"
        UPSSafeMode $1
        ;;
fsd)
        SynoUpsStateLog "synoups fsd"
        /usr/sbin/upsmon -c fsd
        UPSSafeMode $1
        ;;
shutdownups)
        SynoUpsStateLog "synoups shutdownups"
        UPSShutdown
        ;;
status)
        SynoUpsStateLog "synoups status"
        UPSStatusGet
        ;;
waittimeup)
        SynoUpsStateLog "synoups waittimeup"
        UPSWaitTimeUp
        /usr/sbin/upsmon -c fsd
        UPSSafeMode $1
        ;;
statelog)
        SynoUpsStateLog "synoups statelog"
        ;;
esac

flock -u 99
} 99>$FLOCK_FILE








回复 点赞

使用道具 举报

ziwindLv.4 发表于 2021-7-29 01:43:44 | 显示全部楼层
APC Back-UPS650+群晖,市电断电进入安全模式不关机问题解决
回复 点赞

使用道具 举报

gdi2857VIPLv.10 发表于 2021-7-29 14:27:56 | 显示全部楼层
可以百度一下,资料很多。
回复 点赞

使用道具 举报

旧时光影视Lv.1 发表于 2021-7-29 21:31:21 | 显示全部楼层
gdi2857 发表于 2021-7-29 14:27
可以百度一下,资料很多。

关键是群晖7.0系统里面synoups文件结构已经改变了   不是6.2系统里面的语法  所以一脸懵逼
回复 点赞

使用道具 举报

回复

懒得打字嘛,点击右侧快捷回复 【本站酷狼4T,750元】
您需要登录后才可以回帖 登录 | 注册

本版积分规则

投诉/建议联系

support@gebi1.cn

未经授权禁止转载,复制和建立镜像,
如有违反,追究法律责任
  • 关注公众号
  • 添加微信客服
Copyright © 2001-2024 隔壁网 版权所有 All Rights Reserved. 粤ICP备14056481号-1
关灯 在本版发帖
扫一扫添加微信客服
返回顶部
快速回复 返回顶部 返回列表