NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.
Forum Discussion
RangeMethod
Jun 17, 2013Aspirant
ReadyNAS RN 104 Automatic FAN-Control
Hi All, I have a Big Problem with my New (2 Weeks old) ReadyNAS 104. When i have a look at the WEB-UI under the Performance TAB i see the FAN is always running at only ~875 rpm. After a fresh st...
moseleypj
Dec 28, 2013Aspirant
dishmagic66 wrote: You just run it from the prompt?
example:
bash /pathtoscript/fan.sh
your lines in this script and chmod 755 fan.sh
I tried it like this, but not much happening.
Script is running:
root@Readynas:/data/gast# ps aux | grep fan.sh
root 3622 0.0 0.1 4092 784 pts/0 S+ 14:38 0:00 grep fan.sh
Before I say anything else I'd just like to state that I'm no BASH or linux guru. The script I wrote above probably isn't the best and I'd appreciate any advice on improving it.
I placed the script at /root/fanoveride and then get it to start as a service. You need to put the following file in /etc/init.d/fanoveride
#!/bin/sh
### BEGIN INIT INFO
# Provides: FanOveride
# Required-Start: $local_fs $network $named $time $syslog
# Required-Stop: $local_fs $network $named $time $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: FanOveride overides the default ReadyNAS fan control
### END INIT INFO
SCRIPT=~/fanoveride
RUNAS=root
PIDFILE=/var/run/fanoveride.pid
LOGFILE=/var/log/fanoveride.log
start() {
if [ -f /var/run/$PIDNAME ] && kill -0 $(cat /var/run/$PIDNAME); then
echo 'Service already running' >&2
return 1
fi
echo 'Starting service.' >&2
local CMD="$SCRIPT &> \"$LOGFILE\" & echo \$!"
su -c "$CMD" $RUNAS > "$PIDFILE"
echo 'Service started' >&2
}
stop() {
if [ ! -f "$PIDFILE" ] || ! kill -0 $(cat "$PIDFILE"); then
echo 'Service not running' >&2
return 1
fi
echo 'Stopping service.' >&2
kill -15 $(cat "$PIDFILE") && rm -f "$PIDFILE"
echo 'Service stopped' >&2
}
uninstall() {
echo -n "Are you really sure you want to uninstall this service? That cannot be undone. [yes|No] "
local SURE
read SURE
if [ "$SURE" = "yes" ]; then
stop
rm -f "$PIDFILE"
echo "Notice: log file is not be removed: '$LOGFILE'" >&2
update-rc.d -f <NAME> remove
rm -fv "$0"
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
uninstall)
uninstall
;;
retart)
stop
start
;;
*)
echo "Usage: $0 {start|stop|restart|uninstall}"
esac
Be sure to make sure both the script and the init.d script are executable, then run the last command:
chmod +x ~/fanoveride
chmod +x /etc/init.d/fanoveride
update-rc.d fanoveride defaults
You should then be able to run it as a service which starts automatically at boot. To start/stop manually simply run:
service fanoveride start
service fanoveride stop
I've been performing a large file transfer to the device for the last 12 hours or so and before the script the NAS was running at around 60°C and 1000 RPM. With the script and a little tuning I've got it running at 52°C and 1400 RPM. It doesn't seem to make much of a difference to the HDDs but then again they wern't above 40°C so they wern't really the problem anyway! :wink:
Related Content
NETGEAR Academy
Boost your skills with the Netgear Academy - Get trained, certified and stay ahead with the latest Netgear technology!
Join Us!