DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#51 2011-05-03 17:01:31

eilz
New member
Registered: 2011-03-01
Posts: 4

Re: Fan control DNS-323 revision C1 (or DNS-321?)

Some help please, since firmware 1.10 beta the fan stays off till it reaches a very high 43 deg, will this script take care of it.  I have a C1 and wanted to make sure the drive fan starts around 35 deg.  Will these scripts work for me?

Offline

 

#52 2011-05-03 18:44:02

bgravato
Member
Registered: 2010-11-04
Posts: 44

Re: Fan control DNS-323 revision C1 (or DNS-321?)

They should...

Offline

 

#53 2011-05-03 19:37:36

eilz
New member
Registered: 2011-03-01
Posts: 4

Re: Fan control DNS-323 revision C1 (or DNS-321?)

bgravato wrote:

They should...

As a linux newbie, is there a simple dummies guide in doing it, I realise theres load of info on this thread, but finding/making sense is difficult.  Ideally, what I am after is :

I'd like to see the low setting on the fan kick in at 35 deg C and high setting somewhere around 40-42 deg C.  Also wondered if I can put the fan on every couple of hours for a few minutes to to cool the unit while in standby as it appears quite warm even when not used and have fan on low, when disks are active.

thankyou

Offline

 

#54 2011-05-03 19:54:36

bgravato
Member
Registered: 2010-11-04
Posts: 44

Re: Fan control DNS-323 revision C1 (or DNS-321?)

eilz wrote:

bgravato wrote:

They should...

As a linux newbie, is there a simple dummies guide in doing it, I realise theres load of info on this thread, but finding/making sense is difficult.

It has been a while since I did this hack... I posted the instructions for my script already somewhere in this thread I'll try to go back look for it and sum it up...

Have you already installed ffp?

eilz wrote:

Ideally, what I am after is :

I'd like to see the low setting on the fan kick in at 35 deg C and high setting somewhere around 40-42 deg C.  Also wondered if I can put the fan on every couple of hours for a few minutes to to cool the unit while in standby as it appears quite warm even when not used and have fan on low, when disks are active.

thankyou

Could probably be done, but would require a lot more effort... I think the current behaviour with just turning on/off (and on can be low or high speed) depending on temperature thresholds works fine. The script I made has hysteresis and you can set the temperature thresholds you want.

Offline

 

#55 2011-05-05 15:43:32

basergorkobal
New member
Registered: 2011-05-05
Posts: 1

Re: Fan control DNS-323 revision C1 (or DNS-321?)

I see this thread got resurrected, so decided to post.

Firstly - bgravato - thanks for posting your script. Using cron to fire the script looks like a very elegant solution to me (although I am a Linux noob). However I'm having problems getting your script to work properly.

I got both scripts to run when invoked from the command line. fan_ctrl_cron.sh runs and adjusts fan speed according to temp. fan-cron.sh adds a correct line to crontab.
Where it seems to fail is where cron tries to invoke the fan_ctrl_cron.sh at regular intervals. All the file permissions seem correct (set to 777).

When the cron version failed to work I decided to try the other fan control script posted by OP (thanks getik if you ever read this btw:)
Again fan_ctrl.sh seems to work fine when invoked from bash. But when I use the automated funplug script to start it automatically it fails to load.

I didn't have a chance to enable logging yet and go through the logs. But my initial guess is that both solutions seem to fail when loading a script from the ram-drive. Is this a possible cause do you think?
When I get a moment one evening I'll remove the "copy to ram-drive" portion and see if that helps.

Offline

 

#56 2011-05-06 03:58:31

bjby
Member
Registered: 2009-02-22
Posts: 265

Re: Fan control DNS-323 revision C1 (or DNS-321?)

Path variable is set differently in cron compared to a normal login promt. This is often gives people on this forum problems. It is likely this is also your problem. Search this forum for it, there are many threads for it. Hopefully this solves it for you.

Last edited by bjby (2011-05-06 03:59:20)

Offline

 

#57 2011-05-06 04:17:26

bgravato
Member
Registered: 2010-11-04
Posts: 44

Re: Fan control DNS-323 revision C1 (or DNS-321?)

Path on cron should always be full path...
I think that's what I've posted...

I have it working on my unit. I think it's revision B1.

Sorry for not being able to be more helpful at the moment, but these days have been busy... I'll try to have a look at this soon.

Offline

 

#58 2011-05-06 11:12:11

scaramanga
Member
Registered: 2010-08-04
Posts: 251

Re: Fan control DNS-323 revision C1 (or DNS-321?)

bjby wrote:

Path variable is set differently in cron compared to a normal login promt. This is often gives people on this forum problems. It is likely this is also your problem. Search this forum for it, there are many threads for it. Hopefully this solves it for you.

and

bgravato wrote:

Path on cron should always be full path...
I think that's what I've posted...

I have it working on my unit. I think it's revision B1.

Sorry for not being able to be more helpful at the moment, but these days have been busy... I'll try to have a look at this soon.

That's not entirely accurate. A shell can be run interactively (like during telnet/ssh) or non-interactively (when executing a script). Additionally, it may also be a login shell or not. It all boils down to what command-line arguments were used to start it.
Each of these invocation type results in a different behavior during the shell startup. Namely, reading and executing additional commands from certain files, usually used to set-up some sort of environment. Different shell invocation circumstances calls for different settings.

Read about invocation here: http://linux.die.net/man/1/ash
That's why scripts executed by cron (non-interactive) have the PATH variable setup differently then an interactive shell: The interactive shell executes /ffp/etc/profile which sets things up differently. It's not because of cron, but because of how the shell is invoked.


DNS-323 HW Rev. C1 FW 1.10 fun-plug 0.5
2 x WD10EARS-00Y5B1 in Standard mode (LCC set to 5 min; Aligned to 4K)
Transmission with Transmission Remote GUI

Offline

 

#59 2011-05-06 14:15:47

bgravato
Member
Registered: 2010-11-04
Posts: 44

Re: Fan control DNS-323 revision C1 (or DNS-321?)

scaramanga wrote:

That's not entirely accurate. A shell can be run interactively (like during telnet/ssh) or non-interactively (when executing a script). Additionally, it may also be a login shell or not. It all boils down to what command-line arguments were used to start it.
Each of these invocation type results in a different behavior during the shell startup. Namely, reading and executing additional commands from certain files, usually used to set-up some sort of environment. Different shell invocation circumstances calls for different settings.

Read about invocation here: http://linux.die.net/man/1/ash
That's why scripts executed by cron (non-interactive) have the PATH variable setup differently then an interactive shell: The interactive shell executes /ffp/etc/profile which sets things up differently. It's not because of cron, but because of how the shell is invoked.

BTW, that's a manual page for ash, I believe the default shell on dns-323 is bash, but that's irrelevant for the case anyway.

My script can be found on this thread: http://dns323.kood.org/forum/viewtopic.php?id=6072

It's a non-interactive script.

When cron is run it's not run from the login shell so the PATH environment variable may not be set (probably isn't), that's way 1) the script should be invoked with full path from the cron and 2) my script sets the PATH variable within it, so that the commands in the script are searched in that PATH.
Therefore I fail to see what's the problem here with this...

My script was tested with ffp 0.5 installed and on a unit with B1 revision I believe.

I've never tested it with other ffp versions or in any other revision of the unit.

Someone has reported having problems when writing/saving the script with notepad, probably because of windows' carriage return character at the end of each line, which is not used on linux.

Answering to the previous poster... yes chmod 777 seems correct.

Offline

 

#60 2011-05-06 14:21:01

bgravato
Member
Registered: 2010-11-04
Posts: 44

Re: Fan control DNS-323 revision C1 (or DNS-321?)

To change the temperature settings just edit the script and change this values:

Code:

# variables (temperatures are in Fahrenheit)
#
# fan will stop when temperature reaches this value
TEMP_STOP=96
# fan will spin at low speed when temperature reaches this value 
TEMP_LOW=104
# fan will spin at high speed when temperature reaches this value
TEMP_HIGH=113

My unit's temperature command returns values in fahrenheit. YMMV.

As root, run the command

Code:

temperature g 0

Make sure the returned value is fahrenheit too.

Offline

 

#61 2011-05-06 17:46:53

scaramanga
Member
Registered: 2010-08-04
Posts: 251

Re: Fan control DNS-323 revision C1 (or DNS-321?)

bgravato wrote:

BTW, that's a manual page for ash, I believe the default shell on dns-323 is bash, but that's irrelevant for the case anyway.

the busy-box ffp shell is not bash. There's a ffp package of bash if you want/need it.

bgravato wrote:

]My script can be found on this thread: http://dns323.kood.org/forum/viewtopic.php?id=6072
It's a non-interactive script.

Your script is neither interactive nor non-interactive. it's just a script. It all depends on the context of its execution. if you run it from a telnet/ssh command-line, it inherits the settings of that interactive shell. If run from cron - it doesn't have all those settings.

bgravato wrote:

When cron is run it's not run from the login shell so the PATH environment variable may not be set (probably isn't), that's way 1) the script should be invoked with full path from the cron and 2) my script sets the PATH variable within it, so that the commands in the script are searched in that PATH.

even when run by cron, the PATH variable is set. it's just that its value is different.

bgravato wrote:

Therefore I fail to see what's the problem here with this...

Compare the output from:

Code:

echo PATH

to the value you set to path and you'll see the difference.


DNS-323 HW Rev. C1 FW 1.10 fun-plug 0.5
2 x WD10EARS-00Y5B1 in Standard mode (LCC set to 5 min; Aligned to 4K)
Transmission with Transmission Remote GUI

Offline

 

#62 2011-05-06 18:05:24

bgravato
Member
Registered: 2010-11-04
Posts: 44

Re: Fan control DNS-323 revision C1 (or DNS-321?)

scaramanga wrote:

bgravato wrote:

BTW, that's a manual page for ash, I believe the default shell on dns-323 is bash, but that's irrelevant for the case anyway.

the busy-box ffp shell is not bash. There's a ffp package of bash if you want/need it.

True, you're right ffp uses busybox, but I don't think I'm using any bash specific commands/syntax anyway so that shouldn't make a difference.

scaramanga wrote:

Your script is neither interactive nor non-interactive. it's just a script. It all depends on the context of its execution. if you run it from a telnet/ssh command-line, it inherits the settings of that interactive shell. If run from cron - it doesn't have all those settings.

That's a paradox... it either is interactive or it is not... and it isn't it doesn't ask the user any question neither does it stops and waits for any input...

scaramanga wrote:

Compare the output from:

Code:

echo PATH

to the value you set to path and you'll see the difference.

The difference is that I don't put ffp bin and sbin dirs in the path, but as far as I remember I'm not using any ffp binaries in my script... both fanspeed and temperature are commands that are in /usr/sbin which is in my PATH variable in the script.

I still don't see what is the problem here...

Offline

 

#63 2011-05-06 22:16:01

scaramanga
Member
Registered: 2010-08-04
Posts: 251

Re: Fan control DNS-323 revision C1 (or DNS-321?)

what about pidof? Here's what happens on my DNS-323, running ffp 0.5

Code:

/ # which pidof
/ffp/bin/pidof
/ # pidof transmission-daemon
29153 29152 29151 29150
/ # /bin/pidof transmission-daemon

/ #

Because of PATH differences, when run from cron you're using a different pidof.


DNS-323 HW Rev. C1 FW 1.10 fun-plug 0.5
2 x WD10EARS-00Y5B1 in Standard mode (LCC set to 5 min; Aligned to 4K)
Transmission with Transmission Remote GUI

Offline

 

#64 2011-05-06 22:29:21

bgravato
Member
Registered: 2010-11-04
Posts: 44

Re: Fan control DNS-323 revision C1 (or DNS-321?)

scaramanga wrote:

what about pidof? Here's what happens on my DNS-323, running ffp 0.5

Code:

/ # which pidof
/ffp/bin/pidof
/ # pidof transmission-daemon
29153 29152 29151 29150
/ # /bin/pidof transmission-daemon

/ #

Because of PATH differences, when run from cron you're using a different pidof.

I did not intend to use ffp's pidof...

In my system both work:

Code:

root@nas:~# /ffp/bin/pidof smbd
24340 6698 1429 1421
root@nas:~# /bin/pidof smbd
1421 1429 6698 24340
root@nas:~#

I don't know why it doesn't in your case...

Offline

 

#65 2011-06-14 10:25:22

deiv84
New member
Registered: 2011-06-14
Posts: 1

Re: Fan control DNS-323 revision C1 (or DNS-321?)

Hi there!

So what about script written by getik in first post? Does it work well? Any problems with its executing on C1 DNS-323?

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB