Shutdown your NAS based on network traffic statistics.
$ scp auto-poweroff.sh root@diskstation.local:
You can control the monitor job with start
, stop
, restart
and status
commands:
$ ssh root@diskstation.local
$ ./auto-poweroff.sh [start|stop|restart|status]
The job will be killed by the OS once you close the SSH connection and neither
nohub
nor &
will keep it running. Either create crontab entries to start
and stop the monitor at specific times or create a symlink in rc.d
:
$ ln -s /root/auto-poweroff.sh /usr/syno/etc/rc.d/S99auto-poweroff.sh
Options are defined at the top of the script as shell variables:
$ vi auto-poweroff.sh
Config:
LOGFILE
Log file location. Defaults to/var/log/auto-poweroff.log
.MINUTES
Number of silent minutes before automatic poweroff. Defaults to90
.TOLERATE
Number of packages to tolerate per minute. Defaults to100
.DEBUG
Set to1
to see RX/TX diffs every minute in the log file. Note that this will prevent disk spin-down. Defaults to0
.
--minutes
,-m
Overrides the number of minutes
Edit the crontab with vi:
$ vi /etc/crontab
Change the number of minutes to wait to 15 every day at 22:30:
#minute hour mday month wday who command
30 22 * * * root /root/auto-poweroff.sh restart --minutes 15
Restart crond:
$ kill -HUP `pidof crond`
MIT