群辉定时唤醒排查

发现每天同一个时间都会被唤醒

Download Station

于是通过log查看

root@DiskStation:~# cd /var/log
root@DiskStation:/var/log# ls
apparmor.log                disk-latency         esynoscheduler.log  pmesg               scemd.log                  synocmsclient.log         synoreport.log
audio_debug_msg             disk.log             fsck                postgresql.log      scsi_plugin.log            synocrond-execute.log     synoscheduler.log
AudioStation-pgbouncer.log  disk_overview.xml    healthtest          pstore              selfcheck                  synocrond.log             synoservice.log
auth.log                    diskprediction       iscsi.log           rm.log              sfdisk.log                 synofeasibilitycheck.log  synoupdate.log
bash_err.log                dmesg                kern.log            rm.log.1.xz         smart_quick_log            SynoFinder                syslog.log
bash_history.log            dmesg.1.xz           messages            router.log          smart_result               synoindex.log             sysnotify.log
checker.log                 dmesg.2.xz           nginx               rsync.error         space_operation_error.log  synolog                   upstart
datascrubbing.log           downloadstation.log  openvswitch         rsync_signal.error  sssd                       synopkg.log
DeviceBusyList              dpkg_upgrade.log     packages            samba               surveillance               synopoweroff.log
root@DiskStation:/var/log# vim synocrond-execute.log

发现固定唤醒的这几次都有Download Station的身影,于是将DownloadStation停止掉,发现21:55的唤醒还在,其他两次的固定唤醒已经没了

syno_ip_conflict_detect和syno_hungtask_config

发现剩下的大多数的唤醒,都是

builtin-dyn-syno-ip-conflict-detection-syno-ip-conflict-detection with command: /usr/syno/sbin/syno_ip_conflict_detect --detect as user root

停止掉Download Station后,发现一天还是会有大约八次的唤醒,下面是4月1日白天都没有登录的情况下的唤醒记录。主要都是syno_ip_conflict_detect以及同时启动的syno_hungtask_config导致的唤醒。

04-01 00:00:11 running job: builtin-dyn-syno-ip-conflict-detection-syno-ip-conflict-detection with command: /usr/syno/sbin/syno_ip_conflict_detect --detect as user root
04-01 00:00:21 running job: builtin-synodiskhealthprediction-syno_disk_data_collector with command: /usr/syno/bin/synodiskhealthprediction.sh as user root
04-01 00:02:11 running job: builtin-libhwcontrol-syno_hungtask_config with command: /usr/syno/bin/syno_hungtask_config --reset as user root
04-01 06:57:11 running job: builtin-dyn-syno-ip-conflict-detection-syno-ip-conflict-detection with command: /usr/syno/sbin/syno_ip_conflict_detect --detect as user root
04-01 06:57:21 running job: builtin-libhwcontrol-syno_hungtask_config with command: /usr/syno/bin/syno_hungtask_config --reset as user root
04-01 10:50:11 running job: builtin-synobtrfssnap-default with command: /usr/syno/sbin/synobtrfssnap --clean-deleted-subvol as user root
04-01 10:50:21 running job: builtin-synosharing-default with command: /usr/syno/bin/synosharingcron as user root
04-01 17:42:11 running job: builtin-dyn-syno-ip-conflict-detection-syno-ip-conflict-detection with command: /usr/syno/sbin/syno_ip_conflict_detect --detect as user root
04-01 17:42:21 running job: builtin-libhwcontrol-syno_hungtask_config with command: /usr/syno/bin/syno_hungtask_config --reset as user root
04-01 17:42:31 running job: builtin-synosharesnaptree_reconstruct-default with command: /usr/syno/sbin/synosharesnaptree_reconstruct.sh as user root
04-01 21:56:11 running job: builtin-dyn-syno-ip-conflict-detection-syno-ip-conflict-detection with command: /usr/syno/sbin/syno_ip_conflict_detect --detect as user root
04-01 21:56:21 running job: builtin-libhwcontrol-syno_hungtask_config with command: /usr/syno/bin/syno_hungtask_config --reset as user root

打开crontab,想必是crontab中的synoschedtask又从别的地方读取定时任务来执行了。

root@DiskStation:/etc# vim crontab
"crontab" 6L, 308C                                                                                                                                  1,1           All
MAILTO=""
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/syno/sbin:/usr/syno/bin:/usr/local/sbin:/usr/local/bin
#minute hour    mday    month   wday    who command
0   0   1   *   *   root    /usr/syno/bin/syno_disk_health_record
35  0   *   *   6   root    /usr/syno/bin/synoschedtask --run id=1
0   0   9   *   *   root    /usr/syno/bin/synoschedtask --run id=2

crontab中的synoschedtask又是从如下位置读取配置来执行任务

root@DiskStation:/usr/syno/etc# vim scheduled_tasks
[1]
id=1
last work hour=0
can edit owner=0
can delete from ui=1
edit dialog=SYNO.SDS.TaskScheduler.EditDialog
type=weekly
action=#schedule:dsm_autoupdate_notify#
can edit from ui=1
week=0000001
app name=#schedule:dsm_autoupdate_appname#
name=DSM Auto Update
can run app same time=0
owner=0
repeat min store config=
repeat hour store config=
simple edit form=0
repeat hour=0
listable=0
app args=
state=enabled
can run task same time=0
start day=0
cmd=L3Vzci9zeW5vL3NiaW4vc3lub3VwZ3JhZGUgLS1hdXRvdXBkYXRl
run hour=0
edit form=
app=SYNO.SDS.TaskScheduler.DSMAutoUpdate
run min=35
start month=0
can edit name=0
start year=0
can run from ui=0
repeat min=0
[2]
id=2
last work hour=0
can edit owner=0
can delete from ui=1
edit dialog=SYNO.SDS.TaskScheduler.EditDialog
type=monthly
action="#disk_info:disk_smart_test_quick_all#"
can edit from ui=1
week=0000000
app name="#smart:smart_toolbar_smart_test#"
name=Auto S.M.A.R.T. Test
can run app same time=1
owner=0
repeat min store config=[]
repeat hour store config=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]
simple edit form=0
repeat hour=0
listable=1
app args={"enabled":"true","id":"-1","selected_disks":"","task_name":"Auto S.M.A.R.T. Test","test_range":"all","test_style":"quick","test_type":"smart"}
state=enabled
can run task same time=0
start day=9
cmd=L3Vzci9zeW5vL2Jpbi9zeW5vX3NtYXJ0X3Rlc3QgLS10eXBlPXF1aWNrIC0tZGlzaz1hbGw7
run hour=0
edit form=
app="SYNO.SDS.TaskScheduler.SMART"
run min=0
start month=2
can edit name=1
start year=2021
can run from ui=1
repeat min=0
[3]
id=3
last work hour=0
can edit owner=0
can delete from ui=1
edit dialog=SYNO.SDS.TaskScheduler.EditDialog
type=weekly
action=Scan selected checks
can edit from ui=1
week=0000001
app name=#helptoc:securityscan#
name=Run security advisor
can run app same time=1
owner=0
repeat min store config=
repeat hour store config=
simple edit form=0
repeat hour=0
listable=0
app args=
state=disabled
can run task same time=0
start day=0
cmd=L3Vzci9zeW5vL2Jpbi9zeW5vd2ViYXBpIC1leGVjIGFwaT1TWU5PLkNvcmUuU2VjdXJpdHlTY2FuLk9wZXJhdGlvbiBtZXRob2Q9dXBkYXRlIHZlcnNpb249MSAmJiAvdXNyL3N5bm8vYmluL3N5bm93ZWJhcGkgLWV4ZWMgYXBpPVNZTk8uQ29yZS5TZWN1cml0eVNjYW4uT3BlcmF0aW9uIG1ldGhvZD1zdGFydCB2ZXJzaW9uPTEgaXRlbXM9QUxMIG5vdGlmeT10cnVl
run hour=3
edit form=
app=SYNO.SDS.SecurityScan.MainWindow
run min=46
start month=0
can edit name=0
start year=0
can run from ui=1
repeat min=0

不过上面的任务都是几天执行一次的,问题不大。除了上面的任务,还有两处也有定时任务,synocrond-execute.log 中记录的唤醒大多数都是下面的任务导致的:

root@DiskStation:/usr/syno/share/synocron.d# ls
libhwcontrol.conf   synodatacollect.conf           synodisklatencywriteback.conf       synosharing.conf
synobtrfssnap.conf  synodiskhealthprediction.conf  synosharesnaptree_reconstruct.conf
root@DiskStation:/usr/syno/etc/synocron.d# ls
autopkgupgrade.conf  syno-ip-conflict-detection.conf

看到了熟悉的 syno_ip_conflict_detect ,vim打开 syno-ip-conflict-detection.conf ,发现每天的0,6,12,18这几个点,要执行四次

[
   {
      "cmd" : "/usr/syno/sbin/syno_ip_conflict_detect --detect",
      "crontab" : "0 0,6,12,18 * * *",
      "name" : "syno-ip-conflict-detection",
      "period" : "crontab",
      "user" : "root"
   }
]

改成如下,每个月的9号零点执行一次:

[
   {
      "cmd" : "/usr/syno/sbin/syno_ip_conflict_detect --detect",
      "crontab" : "0 0 9 * *",
      "name" : "syno-ip-conflict-detection",
      "period" : "crontab",
      "user" : "root"
   }
]

vim打开 /usr/syno/share/synocron.d/libhwcontrol.conf ,看到了熟悉的 /usr/syno/bin/syno_hungtask_config ,而且唤醒时间跟 syno_ip_conflict_detect 完美吻合

[{
    "cmd": "/usr/syno/bin/syno_disk_db_update",
    "user": "root",
    "period": "monthly",
    "name": "syno_disk_db_update",
    "expire_action": "run",
    "run_on_passive": true
},
{
    "cmd": "/usr/syno/bin/syno_disk_smart_mail_send",
    "user": "root",
    "period": "crontab",
    "crontab": "~ ~ * * 0~3,4~6",
    "name": "syno_disk_smart_mail_send",
    "expire_action": "run",
    "run_on_passive": true
},
{
    "cmd": "/usr/syno/bin/syno_smart_result_collect",
    "user": "root",
    "period": "weekly",
    "name": "syno_smart_result_collect",
    "expire_action": "run",
    "run_on_passive": true
},
{
    "cmd": "/usr/syno/bin/syno_hungtask_config --reset",
    "user": "root",
    "period": "crontab",
    "crontab": "~ 0,6,12,18 * * *",
    "name": "syno_hungtask_config",
    "run_on_passive": true
}]

但是这个不敢改成每个月执行一次,改成每天执行一次就行了:

{
    "cmd": "/usr/syno/bin/syno_hungtask_config --reset",
    "user": "root",
    "period": "crontab",
    "crontab": "~ 0 * * *",
    "name": "syno_hungtask_config",
    "run_on_passive": true
}

重启后,放置一天,发现竟然唤醒次数还是这么多,进去一看,改了crontab的那两个任务竟然还是被唤起,进入上述两个conf文件一看,crontab竟然被恢复了。原来 /usr/syno/etc/synocrond.config 文件才是罪魁祸首。

{
    "jobs": {
        "builtin-dyn-autopkgupgrade-default": {
            "cmd_list": [
                "/tmp/synocrond/builtin-dyn-autopkgupgrade-default",
                "chkupgradepkg"
            ],
            "cmd_str": "/usr/syno/bin/synopkg chkupgradepkg",
            "config": {
                "assure_execute": 168,
                "cmd": "/usr/syno/bin/synopkg chkupgradepkg",
                "crontab": "~ ~ * * 0,1,2,3,5",
                "expire": 24,
                "expire_action": "skip",
                "name": "builtin-dyn-autopkgupgrade-default",
                "period": "crontab",
                "run_on_passive": false,
                "user": "root"
            },
            "expireTime": 0,
            "lastExecution": 1617159010,
            "schedule": {
                "Minute": [
                    9
                ],
                "day": [
                    -1
                ],
                "hour": [
                    0
                ],
                "month": [
                    -1
                ],
                "week": [
                    0,
                    1,
                    2,
                    3,
                    5
                ]
            },
            "startup": 1612807460
        },
        "builtin-dyn-syno-ip-conflict-detection-syno-ip-conflict-detection": {
            "cmd_list": [
                "/tmp/synocrond/builtin-dyn-syno-ip-conflict-detection-syno-ip-conflict-detection",
                "--detect"
            ],
            "cmd_str": "/usr/syno/sbin/syno_ip_conflict_detect --detect",
            "config": {
                "assure_execute": 0,
                "cmd": "/usr/syno/sbin/syno_ip_conflict_detect --detect",
                "crontab": "0 0,6,12,18 * * *",
                "expire": 3,
                "expire_action": "skip",
                "name": "builtin-dyn-syno-ip-conflict-detection-syno-ip-conflict-detection",
                "period": "crontab",
                "run_on_passive": false,
                "user": "root"
            },
            "expireTime": 0,
            "lastExecution": 1617285371,
            "schedule": {
                "Minute": [
                    0
                ],
                "day": [
                    -1
                ],
                "hour": [
                    0,
                    6,
                    12,
                    18
                ],
                "month": [
                    -1
                ],
                "week": [
                    -1
                ]
            },
            "startup": 1616865773
        },
        "builtin-libhwcontrol-syno_disk_db_update": {
            "cmd_list": [
                "/tmp/synocrond/builtin-libhwcontrol-syno_disk_db_update"
            ],
            "cmd_str": "/usr/syno/bin/syno_disk_db_update",
            "config": {
                "assure_execute": 0,
                "cmd": "/usr/syno/bin/syno_disk_db_update",
                "expire": 3,
                "expire_action": "run",
                "name": "builtin-libhwcontrol-syno_disk_db_update",
                "period": "monthly",
                "run_on_passive": true,
                "user": "root"
            },
            "expireTime": 0,
            "lastExecution": 1616735713,
            "schedule": {
                "Minute": [
                    25
                ],
                "day": [
                    10
                ],
                "hour": [
                    21
                ],
                "month": [
                    -1
                ],
                "week": [
                    -1
                ]
            },
            "startup": 1612807383
        },
        "builtin-libhwcontrol-syno_disk_smart_mail_send": {
            "cmd_list": [
                "/tmp/synocrond/builtin-libhwcontrol-syno_disk_smart_mail_send"
            ],
            "cmd_str": "/usr/syno/bin/syno_disk_smart_mail_send",
            "config": {
                "assure_execute": 0,
                "cmd": "/usr/syno/bin/syno_disk_smart_mail_send",
                "crontab": "~ ~ * * 0~3,4~6",
                "expire": 3,
                "expire_action": "run",
                "name": "builtin-libhwcontrol-syno_disk_smart_mail_send",
                "period": "crontab",
                "run_on_passive": true,
                "user": "root"
            },
            "expireTime": 0,
            "lastExecution": 1617061629,
            "schedule": {
                "Minute": [
                    34
                ],
                "day": [
                    -1
                ],
                "hour": [
                    13
                ],
                "month": [
                    -1
                ],
                "week": [
                    2,
                    6
                ]
            },
            "startup": 1612807383
        },
        "builtin-libhwcontrol-syno_hungtask_config": {
            "cmd_list": [
                "/tmp/synocrond/builtin-libhwcontrol-syno_hungtask_config",
                "--reset"
            ],
            "cmd_str": "/usr/syno/bin/syno_hungtask_config --reset",
            "config": {
                "assure_execute": 0,
                "cmd": "/usr/syno/bin/syno_hungtask_config --reset",
                "crontab": "~ 0,6,12,18 * * *",
                "expire": 3,
                "expire_action": "skip",
                "name": "builtin-libhwcontrol-syno_hungtask_config",
                "period": "crontab",
                "run_on_passive": true,
                "user": "root"
            },
            "expireTime": 0,
            "lastExecution": 1617285371,
            "schedule": {
                "Minute": [
                    58
                ],
                "day": [
                    -1
                ],
                "hour": [
                    0,
                    6,
                    12,
                    18
                ],
                "month": [
                    -1
                ],
                "week": [
                    -1
                ]
            },
            "startup": 1612807383
        },
        "builtin-libhwcontrol-syno_smart_result_collect": {
            "cmd_list": [
                "/tmp/synocrond/builtin-libhwcontrol-syno_smart_result_collect"
            ],
            "cmd_str": "/usr/syno/bin/syno_smart_result_collect",
            "config": {
                "assure_execute": 0,
                "cmd": "/usr/syno/bin/syno_smart_result_collect",
                "expire": 3,
                "expire_action": "run",
                "name": "builtin-libhwcontrol-syno_smart_result_collect",
                "period": "weekly",
                "run_on_passive": true,
                "user": "root"
            },
            "expireTime": 0,
            "lastExecution": 1616680572,
            "schedule": {
                "Minute": [
                    4
                ],
                "day": [
                    -1
                ],
                "hour": [
                    16
                ],
                "month": [
                    -1
                ],
                "week": [
                    2
                ]
            },
            "startup": 1612807383
        },
        "builtin-synobtrfssnap-default": {
            "cmd_list": [
                "/tmp/synocrond/builtin-synobtrfssnap-default",
                "--clean-deleted-subvol"
            ],
            "cmd_str": "/usr/syno/sbin/synobtrfssnap --clean-deleted-subvol",
            "config": {
                "assure_execute": 0,
                "cmd": "/usr/syno/sbin/synobtrfssnap --clean-deleted-subvol",
                "expire": 3,
                "expire_action": "skip",
                "name": "builtin-synobtrfssnap-default",
                "period": "daily",
                "run_on_passive": false,
                "user": "root"
            },
            "expireTime": 0,
            "lastExecution": 1617245411,
            "schedule": {
                "Minute": [
                    21
                ],
                "day": [
                    -1
                ],
                "hour": [
                    8
                ],
                "month": [
                    -1
                ],
                "week": [
                    -1
                ]
            },
            "startup": 1612807383
        },
        "builtin-synodatacollect-udc": {
            "cmd_list": [
                "/tmp/synocrond/builtin-synodatacollect-udc",
                "udc"
            ],
            "cmd_str": "/usr/syno/bin/synodatacollect udc ",
            "config": {
                "assure_execute": 0,
                "cmd_list": [
                    "/usr/syno/bin/synodatacollect",
                    "udc"
                ],
                "crontab": "~ ~ * * 0~6",
                "expire": 72,
                "expire_action": "skip",
                "name": "builtin-synodatacollect-udc",
                "period": "crontab",
                "run_on_passive": false,
                "user": "root"
            },
            "expireTime": 0,
            "lastExecution": 1616499310,
            "schedule": {
                "Minute": [
                    34
                ],
                "day": [
                    -1
                ],
                "hour": [
                    17
                ],
                "month": [
                    -1
                ],
                "week": [
                    6
                ]
            },
            "startup": 1612807383
        },
        "builtin-synodatacollect-udc-disk": {
            "cmd_list": [
                "/tmp/synocrond/builtin-synodatacollect-udc-disk",
                "disk"
            ],
            "cmd_str": "/usr/syno/bin/synodiskdatacollect disk ",
            "config": {
                "assure_execute": 0,
                "cmd_list": [
                    "/usr/syno/bin/synodiskdatacollect",
                    "disk"
                ],
                "crontab": "~ ~ * * 0~6",
                "expire": 72,
                "expire_action": "skip",
                "name": "builtin-synodatacollect-udc-disk",
                "period": "crontab",
                "run_on_passive": false,
                "user": "root"
            },
            "expireTime": 0,
            "lastExecution": 1616735713,
            "schedule": {
                "Minute": [
                    33
                ],
                "day": [
                    -1
                ],
                "hour": [
                    16
                ],
                "month": [
                    -1
                ],
                "week": [
                    0
                ]
            },
            "startup": 1612807383
        },
        "builtin-synodiskhealthprediction-syno_disk_data_collector": {
            "cmd_list": [
                "/tmp/synocrond/builtin-synodiskhealthprediction-syno_disk_data_collector"
            ],
            "cmd_str": "/usr/syno/bin/synodiskhealthprediction.sh",
            "config": {
                "assure_execute": 0,
                "cmd": "/usr/syno/bin/synodiskhealthprediction.sh",
                "crontab": "0 0 * * *",
                "expire": 24,
                "expire_action": "skip",
                "name": "builtin-synodiskhealthprediction-syno_disk_data_collector",
                "period": "crontab",
                "run_on_passive": true,
                "user": "root"
            },
            "expireTime": 0,
            "lastExecution": 1617206411,
            "schedule": {
                "Minute": [
                    0
                ],
                "day": [
                    -1
                ],
                "hour": [
                    0
                ],
                "month": [
                    -1
                ],
                "week": [
                    -1
                ]
            },
            "startup": 1612807383
        },
        "builtin-synodisklatencywriteback-syno_disk_latency_collector_writeback": {
            "cmd_list": [
                "/tmp/synocrond/builtin-synodisklatencywriteback-syno_disk_latency_collector_writeback",
                "writeback"
            ],
            "cmd_str": "/usr/syno/bin/syno_disk_latency_collector writeback ",
            "config": {
                "assure_execute": 0,
                "cmd_list": [
                    "/usr/syno/bin/syno_disk_latency_collector",
                    "writeback"
                ],
                "expire": 8,
                "expire_action": "run",
                "name": "builtin-synodisklatencywriteback-syno_disk_latency_collector_writeback",
                "period": "weekly",
                "run_on_passive": true,
                "user": "root"
            },
            "expireTime": 0,
            "lastExecution": 1616672352,
            "schedule": {
                "Minute": [
                    39
                ],
                "day": [
                    -1
                ],
                "hour": [
                    2
                ],
                "month": [
                    -1
                ],
                "week": [
                    0
                ]
            },
            "startup": 1612807383
        },
        "builtin-synosharesnaptree_reconstruct-default": {
            "cmd_list": [
                "/tmp/synocrond/builtin-synosharesnaptree_reconstruct-default"
            ],
            "cmd_str": "/usr/syno/sbin/synosharesnaptree_reconstruct.sh",
            "config": {
                "assure_execute": 0,
                "cmd": "/usr/syno/sbin/synosharesnaptree_reconstruct.sh",
                "expire": 3,
                "expire_action": "skip",
                "name": "builtin-synosharesnaptree_reconstruct-default",
                "period": "daily",
                "run_on_passive": false,
                "user": "root"
            },
            "expireTime": 0,
            "lastExecution": 1617270131,
            "schedule": {
                "Minute": [
                    55
                ],
                "day": [
                    -1
                ],
                "hour": [
                    12
                ],
                "month": [
                    -1
                ],
                "week": [
                    -1
                ]
            },
            "startup": 1612807383
        },
        "builtin-synosharing-default": {
            "cmd_list": [
                "/tmp/synocrond/builtin-synosharing-default"
            ],
            "cmd_str": "/usr/syno/bin/synosharingcron",
            "config": {
                "assure_execute": 0,
                "cmd": "/usr/syno/bin/synosharingcron",
                "crontab": "~ 0~7 * * *",
                "expire": 24,
                "expire_action": "skip",
                "name": "builtin-synosharing-default",
                "period": "crontab",
                "run_on_passive": false,
                "user": "root"
            },
            "expireTime": 0,
            "lastExecution": 1617245411,
            "schedule": {
                "Minute": [
                    5
                ],
                "day": [
                    -1
                ],
                "hour": [
                    7
                ],
                "month": [
                    -1
                ],
                "week": [
                    -1
                ]
            },
            "startup": 1612807383
        }
    }
}

为了方便编辑,将文件复制到共享文件夹

root@DiskStation:/volume1/DiskStation# cp /usr/syno/etc/synocrond.config /volume1/DiskStation/synocrond.json

编辑那两个任务的crontab和schedule字段

        "builtin-dyn-syno-ip-conflict-detection-syno-ip-conflict-detection": {
            "cmd_list": [
                "/tmp/synocrond/builtin-dyn-syno-ip-conflict-detection-syno-ip-conflict-detection",
                "--detect"
            ],
            "cmd_str": "/usr/syno/sbin/syno_ip_conflict_detect --detect",
            "config": {
                "assure_execute": 0,
                "cmd": "/usr/syno/sbin/syno_ip_conflict_detect --detect",
                "crontab": "0 0 9 * *",
                "expire": 3,
                "expire_action": "skip",
                "name": "builtin-dyn-syno-ip-conflict-detection-syno-ip-conflict-detection",
                "period": "crontab",
                "run_on_passive": false,
                "user": "root"
            },
            "expireTime": 0,
            "lastExecution": 1617285371,
            "schedule": {
                "Minute": [
                    0
                ],
                "day": [
                    9
                ],
                "hour": [
                    0
                ],
                "month": [
                    -1
                ],
                "week": [
                    -1
                ]
            },
            "startup": 1616865773
        },
        "builtin-libhwcontrol-syno_hungtask_config": {
            "cmd_list": [
                "/tmp/synocrond/builtin-libhwcontrol-syno_hungtask_config",
                "--reset"
            ],
            "cmd_str": "/usr/syno/bin/syno_hungtask_config --reset",
            "config": {
                "assure_execute": 0,
                "cmd": "/usr/syno/bin/syno_hungtask_config --reset",
                "crontab": "~ 0 * * *",
                "expire": 3,
                "expire_action": "skip",
                "name": "builtin-libhwcontrol-syno_hungtask_config",
                "period": "crontab",
                "run_on_passive": true,
                "user": "root"
            },
            "expireTime": 0,
            "lastExecution": 1617285371,
            "schedule": {
                "Minute": [
                    58
                ],
                "day": [
                    -1
                ],
                "hour": [
                    0
                ],
                "month": [
                    -1
                ],
                "week": [
                    -1
                ]
            },
            "startup": 1612807383
        },

保存后再将配置文件覆盖回去

root@DiskStation:/volume1/DiskStation# cp /volume1/DiskStation/synocrond.json /usr/syno/etc/synocrond.config

重启后,发现 synocrond.config 这个文件竟然被重置了,诡异的是, builtin-libhwcontrol-syno_hungtask_config 的contab有保留更改,builtin-dyn-syno-ip-conflict-detection-syno-ip-conflict-detection 的crontab彻底被重置了。不过令人惊喜的是,/usr/syno/share/synocron.d/libhwcontrol.conf 的 syno_hungtask_config 节点有跟着自动被修改成每天零点执行:

{
    "cmd": "/usr/syno/bin/syno_hungtask_config --reset",
    "user": "root",
    "period": "crontab",
    "crontab": "~ 0 * * *",
    "name": "syno_hungtask_config",
    "run_on_passive": true
}

寻思着不改这么激进,让 ip-conflict 跟 hungtask 一样,改成每天凌晨0点执行,结果试了ip-conflict还是会被重置。

这时候发现了/usr/syno/etc/syno_ip_conflict_detect.conf 这个文件,于是将yes修改成no,结果重启后,/usr/syno/etc/synocrond.config 中builtin-dyn-syno-ip-conflict-detection-syno-ip-conflict-detection 的crontab依然被重置成 0 0,6,12,18 * * *

root@DiskStation:/usr/syno/etc# vim syno_ip_conflict_detect.conf
enable=no
period=30

但是 /usr/syno/etc/synocron.d 下的 syno-ip-conflict-detection.conf 文件消失了,觉得有希望,继续放一天看日志

root@DiskStation:/usr/syno/etc/synocron.d# ls
autopkgupgrade.conf

一天后,发现成功让 ip-conflict 跟 hungtask 任务都不再每隔几个小时唤醒一次,一整天都因为定时任务唤醒的次数明显变少

04-03 01:49:22 running job: builtin-synosharesnaptree_reconstruct-default with command: /usr/syno/sbin/synosharesnaptree_reconstruct.sh as user root
04-03 21:56:38 running job: builtin-synodatacollect-udc with command: /usr/syno/bin/synodatacollect udc  as user root

synosharingcron

继续处理每天一次的定时任务 builtin-synosharing-default with command: /usr/syno/bin/synosharingcron as user root

root@DiskStation:/usr/syno/share/synocron.d# vim synosharing.conf
{
   "cmd" : "/usr/syno/bin/synosharingcron",
   "crontab" : "~ 0~7 * * *",
   "expire" : 24,
   "expire_action" : "skip",
   "period" : "crontab",
   "user" : "root"
}

改成每周日才执行

{
   "cmd" : "/usr/syno/bin/synosharingcron",
   "crontab" : "~ 0~7 * * 0",
   "expire" : 24,
   "expire_action" : "skip",
   "period" : "crontab",
   "user" : "root"
}

/usr/syno/etc/synocrond.config 中的 builtin-synosharing-default 节点也改一遍crontab和schedule

"builtin-synosharing-default": {
    "cmd_list": [
        "/tmp/synocrond/builtin-synosharing-default"
    ],
    "cmd_str": "/usr/syno/bin/synosharingcron",
    "config": {
        "assure_execute": 0,
        "cmd": "/usr/syno/bin/synosharingcron",
        "crontab": "~ 0~7 * * *",
        "expire": 24,
        "expire_action": "skip",
        "name": "builtin-synosharing-default",
        "period": "crontab",
        "run_on_passive": false,
        "user": "root"
    },
    "expireTime": 0,
    "lastExecution": 1617383733,
    "schedule": {
        "Minute": [
            23
        ],
        "day": [
            -1
        ],
        "hour": [
            1
        ],
        "month": [
            -1
        ],
        "week": [
            -1
        ]
    },
    "startup": 1612807383
}

改为

"builtin-synosharing-default": {
    "cmd_list": [
        "/tmp/synocrond/builtin-synosharing-default"
    ],
    "cmd_str": "/usr/syno/bin/synosharingcron",
    "config": {
        "assure_execute": 0,
        "cmd": "/usr/syno/bin/synosharingcron",
        "crontab": "~ 0~7 * * 0",
        "expire": 24,
        "expire_action": "skip",
        "name": "builtin-synosharing-default",
        "period": "crontab",
        "run_on_passive": false,
        "user": "root"
    },
    "expireTime": 0,
    "lastExecution": 1617383733,
    "schedule": {
        "Minute": [
            30
        ],
        "day": [
            -1
        ],
        "hour": [
            0
        ],
        "month": [
            -1
        ],
        "week": [
            0
        ]
    },
    "startup": 1612807383
}

重启后发现 /usr/syno/share/synocron.d/synosharing.conf 的修改还在; /usr/syno/etc/synocrond.config 的修改也还在,但是schedule中的Minute和hour被重置了。等待一天后,果然 builtin-synosharing-default with command: /usr/syno/bin/synosharingcron as user root 这条之前每天都会执行的定时任务没有再执行。

chkupgradepkg

root@DiskStation:/usr/syno/etc/synocron.d# vim autopkgupgrade.conf
{
   "assure_execute" : 168,
   "cmd" : "/usr/syno/bin/synopkg chkupgradepkg",
   "crontab" : "~ ~ * * 0,1,2,3,5",
   "expire" : 24,
   "expire_action" : "skip",
   "name" : "autopkgupgrade",
   "period" : "crontab",
   "user" : "root"
}

改为只在周日执行

{
   "assure_execute" : 168,
   "cmd" : "/usr/syno/bin/synopkg chkupgradepkg",
   "crontab" : "~ ~ * * 0",
   "expire" : 24,
   "expire_action" : "skip",
   "name" : "autopkgupgrade",
   "period" : "crontab",
   "user" : "root"
}

/usr/syno/etc/synocrond.config 中的 builtin-synosharing-default 节点也改一遍crontab和schedule

"builtin-dyn-autopkgupgrade-default": {
    "cmd_list": [
        "/tmp/synocrond/builtin-dyn-autopkgupgrade-default",
        "chkupgradepkg"
    ],
    "cmd_str": "/usr/syno/bin/synopkg chkupgradepkg",
    "config": {
        "assure_execute": 168,
        "cmd": "/usr/syno/bin/synopkg chkupgradepkg",
        "crontab": "~ ~ * * 0,1,2,3,5",
        "expire": 24,
        "expire_action": "skip",
        "name": "builtin-dyn-autopkgupgrade-default",
        "period": "crontab",
        "run_on_passive": false,
        "user": "root"
    },
    "expireTime": 0,
    "lastExecution": 1617746212,
    "schedule": {
        "Minute": [
            10
        ],
        "day": [
            -1
        ],
        "hour": [
            10
        ],
        "month": [
            -1
        ],
        "week": [
            0,
            1,
            2,
            3,
            5
        ]
    },
    "startup": 1612807460
}

改为

"builtin-dyn-autopkgupgrade-default": {
    "cmd_list": [
        "/tmp/synocrond/builtin-dyn-autopkgupgrade-default",
        "chkupgradepkg"
    ],
    "cmd_str": "/usr/syno/bin/synopkg chkupgradepkg",
    "config": {
        "assure_execute": 168,
        "cmd": "/usr/syno/bin/synopkg chkupgradepkg",
        "crontab": "~ ~ * * 0",
        "expire": 24,
        "expire_action": "skip",
        "name": "builtin-dyn-autopkgupgrade-default",
        "period": "crontab",
        "run_on_passive": false,
        "user": "root"
    },
    "expireTime": 0,
    "lastExecution": 1617746212,
    "schedule": {
        "Minute": [
            30
        ],
        "day": [
            -1
        ],
        "hour": [
            0
        ],
        "month": [
            -1
        ],
        "week": [
            0
        ]
    },
    "startup": 1612807460
}

重启后发现 /usr/syno/etc/synocron.d/autopkgupgrade.conf 的修改还在,但是 /usr/syno/etc/synocrond.config 的修改被重置了。

时间对齐

剩下的定时任务都是硬盘相关的,不敢随便取消,所以只能尽量将任务的时间对齐,减少唤醒次数,但是 /usr/syno/etc/synocrond.config 中对crontab的修改开机会被重置为随机时间,并且实际执行的时候还不是这个时间。而 /usr/syno/share/synocron.d 下的各个conf有多个是daily没有指定具体crontab,或者即使指定了,实际执行的时候也不是按照这个时间,所以还没有找到规律,暂时无法将剩余的任务时间对齐。

04-12 00:30:28 running job: builtin-synodiskhealthprediction-syno_disk_data_collector with command: /usr/syno/bin/synodiskhealthprediction.sh as user root
04-12 00:30:38 running job: builtin-synodisklatencywriteback-syno_disk_latency_collector_writeback with command: /usr/syno/bin/syno_disk_latency_collector writeback  as user root
04-12 01:19:28 running job: builtin-libhwcontrol-syno_hungtask_config with command: /usr/syno/bin/syno_hungtask_config --reset as user root
04-12 06:21:29 running job: builtin-synodisklatencywriteback-syno_disk_latency_collector_writeback with command: /usr/syno/bin/syno_disk_latency_collector writeback  as user root
04-12 21:56:29 running job: builtin-synobtrfssnap-default with command: /usr/syno/sbin/synobtrfssnap --clean-deleted-subvol as user root
04-12 21:56:39 running job: builtin-synosharesnaptree_reconstruct-default with command: /usr/syno/sbin/synosharesnaptree_reconstruct.sh as user root

结果

从一天唤醒9-10次降低为7-8次,效果不是很明显。

Share

You may also like...

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注