Add code to shut down when no network connection

I use mycloud for one specific purpose, that it is connected directly to my Playstation 2 and stores games that are loaded via smb share. No other use. Only thing I dont like is that it is powered all the time.

Im wondering if it is possible to edit a script to power off the mycloud when it no longer detects a network. Turning off the PS2 causes network loss.

When it detects lose of network, the white led starts flashing, whatever script initiates this behaviour, I would like to add the power off/shutdown command also.

Anyone know of such a script, and what the shutdown command is?

So after a bit of searching I found the script that detects the network is down, enables the white flashing led and logs the message “networkLinkDown”.



. /etc/nas/config/share-param.conf
. /etc/nas/
[ -f /usr/local/sbin/ ] && . /usr/local/sbin/

set -e


case “$2” in
#ITR# 69883 found that Apache needed to be restarted(not just reloaded) to
#support forcing UI access to only occur on same network.
#ITR# 75893 found that when host name is changed and interface goes up and
#down, Apache task doing rename is not allowed to finish and all services
#are not restarted with new name.
#/tmp/restartApache is used to signal when Apache needs to be restarted.
touch /tmp/restartApache
/sbin/ifup -v $1
rm /tmp/restartApache || true
touch $link_up
if [ “” == “good” ] && [ “” == “ready” ]; then
## change led color to ok (green) LED_EV_NETWORK LED_STAT_OK
if [ -f $link_down_after_up ]; then “${networkLinkDown}”
rm $link_down_after_up
/sbin/ifdown --force -v $1

## change led color to error LED_EV_NETWORK LED_STAT_ERR

if [ -f $link_up ]; then
    touch $link_down_after_up
    rm $link_up


Question: How can I add the shutdown command to execute after the change led color to error? LED_EV_NETWORK LED_STAT_ERR

Note: I am using WDMyCloud, single bay, Firmware v04.05.00-320.

It appears that I put in the below line:

##change led color to error LED_EV_NETWORK LED_STAT_ERR

##power off
/sbin/shutdown -h -P now