I have a Unifi cloud key (as part of a UDM), a DS918, and a low end Cyberpower UPS attached via usb to the DS.
The cloud key can have well documented database corruption issues if it loses power abruptly, so I'd like to run a shell script when the synology enters Safe Mode prior, prior to sending the shutdown signal back to the UPS.
(i) The simplest way would be to have a shell script triggered when the synology enters Safe Mode, but the only options for triggering in DSM are for Power On and Shutdown.
- Is there anything I can poll from a script to tell if the DSM is in Safe Mode ?
(ii) Another way I can think of would be to modify DSM's built-in NUT package (which I'm reluctant to do as it will probably be overwritten with DSM updates). However if it's the only option, am I on the right track with:
- modifying the CMDSCRIPT in /usr/syno/bin/synoups
- the 'fsd' case is the correct one to edit (as this is the actual shutdown command issued to the UPS) ?
- add in my command (ie ssh to the cloudkey and issue a poweroff) prior to the command /usr/sbin/upsmon -c fsd (which I believe is the final shutdown command back to the UPS) ?
The cloud key can have well documented database corruption issues if it loses power abruptly, so I'd like to run a shell script when the synology enters Safe Mode prior, prior to sending the shutdown signal back to the UPS.
(i) The simplest way would be to have a shell script triggered when the synology enters Safe Mode, but the only options for triggering in DSM are for Power On and Shutdown.
- Is there anything I can poll from a script to tell if the DSM is in Safe Mode ?
(ii) Another way I can think of would be to modify DSM's built-in NUT package (which I'm reluctant to do as it will probably be overwritten with DSM updates). However if it's the only option, am I on the right track with:
- modifying the CMDSCRIPT in /usr/syno/bin/synoups
- the 'fsd' case is the correct one to edit (as this is the actual shutdown command issued to the UPS) ?
- add in my command (ie ssh to the cloudkey and issue a poweroff) prior to the command /usr/sbin/upsmon -c fsd (which I believe is the final shutdown command back to the UPS) ?