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

#1 2007-07-09 12:39:46

Panda
Member
Registered: 2007-05-15
Posts: 14

Cant get myfan.sh to work

Hi,

Being an almost pure windows man, this is a bit alien to me, but I've read up and tried to get the fan speed script running. I don't think it is even getting started though cos I can't see any logs from it.

I know my fun_plug is working at least to some level cos I can get telnet going. When I telnet to the box and list the files in tmp, I don't see any logs from myfan, so I guess it isn't starting.

Is there a problem with my fun_plug ?...



dmesg > /mnt/HD_a2/dmesg.out
/mnt/HD_a2/nc -l -p 10000 -e /bin/sh &

mkdir /mnt/HD_a2/lnx_bin/
cd /mnt/HD_a2/lnx_bin/

export PATH=$PATH:/mnt/HD_a2/lnx_bin/

/mnt/HD_a2/myfan.sh &
/mnt/HD_a2/starttelnet.sh

Offline

 

#2 2007-07-09 13:27:22

dkl
Member
From: Toulouse
Registered: 2007-06-16
Posts: 104

Re: Cant get myfan.sh to work

Hello

Are you sure about the exec rights of your my_fan script? Can you give the result of the "ls -l /mnt/HD_a2/myfan.sh" command issue from your telnet connection?

Do you have any message when running your script manually (i.e from your telnet connection?)

What does you script run exactly? Does it launch fancontrol? Can you check the process is running ("ps -edf | grep fan")?

  Regards

Offline

 

#3 2007-07-09 14:07:31

Panda
Member
Registered: 2007-05-15
Posts: 14

Re: Cant get myfan.sh to work

Result from ls command...

-rwxrwxrwx    1 nobody   501          3371 Jul  8 11:15 /mnt/HD_a2/myfan.sh

Don't know how to run the script manually - tried typing the name but it just says not found...

/mnt/HD_a2/lnx_bin/sh: /mnt/HD_a2/myfan.sh: not found

Results of ps command...

  927 root        228 S   fancontrol
3217 root        244 S   grep fan

The script is from this thread...

http://dns323.kood.org/forum/t185-does-time.html

Thanks for helping big_smile

Offline

 

#4 2007-07-09 14:52:32

dkl
Member
From: Toulouse
Registered: 2007-06-16
Posts: 104

Re: Cant get myfan.sh to work

Hello

- execution rights are OK

- to run the script manually, from telnet, type "/mnt/HD_a2/myfan.sh" (simple, is'nt it?)

- if you speak about the script in the wiki, you should pay attention to the C/F temperature unit. As far as I know, some Firmware/Boxes? return the temperature in Celsius, and others in Farenheit... It's not clear yet, at least for me. For example, mine is in Celsius in FW 1.03. The script MUST be adapted to this. I think you get the unit when typing "temperature g 0".

- you process "fancontrol" is running, so I guest your script is running OK. I am not in front of the box here, but I think that fancontrol is NOT launched natively by the DNS323. So if it runs, this should mean you are OK. To be absolutely sure, restart your fun_plug manually:

cd /mnt/HD_a2
./fun_plug

and check that the pid of fancontrol has changed. If not, this means your script does not run properly.

- have you noticed anyway that the fan speed is now controlled? You box should make VERY low noise when disks are "sleeping". What about the fanspeed you read ("fanspeed g")?

Offline

 

#5 2007-07-09 15:15:36

Panda
Member
Registered: 2007-05-15
Posts: 14

Re: Cant get myfan.sh to work

I don't think my script is running, as the fan runs at 2700 when drives are idle. Also, the script seems to kill the fancontrol process when it runs, so shouldn't I see another process instead (myfan ?)

I tried just typing the script name, but it says not found.

Also, when I re-run fun_plug, I get the following...

./fun_plug: /mnt/HD_a2/nc: No such file or directory
./fun_plug: /mnt/HD_a2/myfan.sh: No such file or directory
mknod: /dev/ptyp0: File exists
mknod: /dev/ttyp0: File exists
telnetd: starting
  port: 23; login program: /mnt/HD_a2/lnx_bin/sh
bind: Address already in use

which again suggests that for some reason the myfan.sh file cannot be found !?!?!?

My box returns fahrenheit, so the script should run with no mods as far as I can see.

Cheers - Paul

Offline

 

#6 2007-07-09 15:58:13

dkl
Member
From: Toulouse
Registered: 2007-06-16
Posts: 104

Re: Cant get myfan.sh to work

OK. For sure, your script is not run, neither your "nc" script by the way, so the problem does NOT come from your "myfan" script. For the moment, I have no idea... It looks like something is wrong in the directory name, or your environment, but I cant find it for the moment...

At least, try (in telnet):
"cd /mnt/HD_a2"
"./myfan.sh&"

Offline

 

#7 2007-07-09 16:13:44

dkl
Member
From: Toulouse
Registered: 2007-06-16
Posts: 104

Re: Cant get myfan.sh to work

Can you also give the result of "ls -l" on /mnt/HD_a2 and /mnt/HD_a2/lnx_bin

Offline

 

#8 2007-07-09 16:31:19

Panda
Member
Registered: 2007-05-15
Posts: 14

Re: Cant get myfan.sh to work

/mnt/HD_a2 gives...

-rw-r--r--    1 root     root         7635 Jul  9 13:07 dmesg.out
-rwxrwxrwx    1 nobody   501           206 Jul  9 09:26 fun_plug
drwxrwxrwx    2 Panda    502          4096 Jul  9 13:07 lnx_bin
-rwxrwxrwx    1 nobody   501          3371 Jul  8 11:15 myfan.sh
-rwxrwxrwx    1 Panda    502           351 May 30 15:00 starttelnet.sh

Plus my windows folders which I have removed.

/mnt/HD_a2/lnx_bin gives...

-rwxrwxrwx    1 Panda    502        891228 May 30 15:02 busybox3
lrwxrwxrwx    1 root     root           27 Jul  9 13:07 sh -> /mnt/HD_a2/lnx_bin
/busybox3
-rwxrwxrwx    1 Panda    502         56425 May 30 15:02 utelnetd

I have no idea what the "nc" script is supposed to do - I copied the fun_plug file from this forum somewhere. It won't work cos I have no nc script !

Thanks for all the help - much appreciated. Wish I knew a little more about Linux.

Offline

 

#9 2007-07-09 17:47:48

dkl
Member
From: Toulouse
Registered: 2007-06-16
Posts: 104

Re: Cant get myfan.sh to work

If you do not have any "nc" script, you should delete this line from your fun_plug.
Better also to change owner rights to Panda:502 on fun_plug and myfan.sh (not sure it will solve your problem...).
"chown Panda:502 <file-name>"

Another strange thing is that the directory creation "mkdir /mnt/HD_a2/lnx_bin" in your fun_plug should issue an error (directory already exists) but I can't see it...

So edit you fun_plug, remove the nc line, put a comment "#" at the beginnig of the line for myfan, and let's see the outpout of this.

How do you transfer files (scripts) on the box? Aren't you experiencing problems with CR/LF? If you use FTP, you must make transfers in ASC mode (i.e not BIN).

Offline

 

#10 2007-07-09 17:59:57

Panda
Member
Registered: 2007-05-15
Posts: 14

Re: Cant get myfan.sh to work

I normally upload files via FTP with no problem, however I suspect that at some time I mistakenly opened the file from windows and edited it, which is how I think the owner got changed.

My editor allows me to use unix files so no problems with the cr/lf conversions. I always make sure to save in Unix too.

Did as you said...

-rwxrwxrwx    1 Panda    502          1614 Jun  5 22:03 ctrl_fanspeed.sh
-rw-r--r--    1 root     root         7644 Jul  9 15:56 dmesg.out
-rwxrwxrwx    1 Panda    502           167 Jul  9 15:56 fun_plug
drwxrwxrwx    2 Panda    502          4096 Jul  9 15:56 lnx_bin
-rwxrwxrwx    1 Panda    502          3371 Jul  9 14:34 myfan.sh
-rwxrwxrwx    1 Panda    502           351 May 30 15:00 starttelnet.sh

and here is the result of running fun_plug now...

./fun_plug: /mnt/HD_a2/myfan.sh: No such file or directory
mknod: /dev/ptyp0: File exists
mknod: /dev/ttyp0: File exists
telnetd: starting
  port: 23; login program: /mnt/HD_a2/lnx_bin/sh
bind: Address already in use

Probably just my imagination, but the box now seems to be running the fan more than when I started big_smile

Offline

 

#11 2007-07-09 18:13:53

dkl
Member
From: Toulouse
Registered: 2007-06-16
Posts: 104

Re: Cant get myfan.sh to work

I don't see yet wher eyour 2 errors concerning ptyp0 and ttyp0 come from. Look like you have something wrong somewhere concerning redirection.

You should come back first to a minimal fun_plug that does not show any error. try this one:


####dmesg > /mnt/HD_a2/dmesg.out
####/mnt/HD_a2/nc -l -p 10000 -e /bin/sh &

####mkdir /mnt/HD_a2/lnx_bin/
####cd /mnt/HD_a2/lnx_bin/

export PATH=$PATH:/mnt/HD_a2/lnx_bin/

####/mnt/HD_a2/myfan.sh &
/mnt/HD_a2/starttelnet.sh

Offline

 

#12 2007-07-09 18:22:56

Panda
Member
Registered: 2007-05-15
Posts: 14

Re: Cant get myfan.sh to work

Ok, done as you said and still get those errors...

mknod: /dev/ptyp0: File exists
mknod: /dev/ttyp0: File exists
telnetd: starting
  port: 23; login program: /mnt/HD_a2/lnx_bin/sh
bind: Address already in use

Offline

 

#13 2007-07-09 18:38:18

Emacs
Member
Registered: 2007-06-24
Posts: 110

Re: Cant get myfan.sh to work

I understand you get these messages when you run the fun_plug manually?

In that case I would imagine that the /dev files and the telnetd are already created/running.
Hence the message appear _only_ when run repeatedly.

Cheers,

Emacs

Offline

 

#14 2007-07-09 18:46:32

dkl
Member
From: Toulouse
Registered: 2007-06-16
Posts: 104

Re: Cant get myfan.sh to work

OK. Then create a very simple script named "test.sh", with one simple line (echo "test" for example), give it exec rights (chmod 755 test.sh).
Run it manually to check:
"/mnt/HD_a2/test.sh"
This should print "test" on the screen.

If this works, insert "/mnt/HD_a2/test.sh" in your fun_plug. Then run again fun_plug.

Sorry to go step by step, but this *should* work!!!

Offline

 

#15 2007-07-09 20:06:06

Panda
Member
Registered: 2007-05-15
Posts: 14

Re: Cant get myfan.sh to work

OK, if I wasn't confused before, I am now...

It worked fine !!...

Test
mknod: /dev/ptyp0: File exists
mknod: /dev/ttyp0: File exists
telnetd: starting
  port: 23; login program: /mnt/HD_a2/lnx_bin/sh
bind: Address already in use

Offline

 

#16 2007-07-09 20:14:11

Panda
Member
Registered: 2007-05-15
Posts: 14

Re: Cant get myfan.sh to work

This makes no sense (at least to me).

Here is (again) the directory listing...

-rw-r--r--    1 root     root         7644 Jul  9 15:56 dmesg.out
-rwxrwxrwx    1 Panda    502           240 Jul  9 18:09 fun_plug
drwxrwxrwx    2 Panda    502          4096 Jul  9 18:09 lnx_bin
-rwxrwxrwx    1 Panda    502          3392 Jul  9 18:07 myfan.sh
-rwxrwxrwx    1 Panda    502           351 May 30 15:00 starttelnet.sh
-rwxrwxrwx    1 Panda    502            12 Jul  9 18:03 test.sh

Both myfan.sh & test.sh are in the same directory, but fun_plug gives this when I add the call to myfan.sh I get this (again)...

Test
./fun_plug: /mnt/HD_a2/myfan.sh: No such file or directory
mknod: /dev/ptyp0: File exists
mknod: /dev/ttyp0: File exists
telnetd: starting
  port: 23; login program: /mnt/HD_a2/lnx_bin/sh
bind: Address already in use

AND when I run them from telnet...

# # ./test.sh

Test
# # ./myfan.sh

/mnt/HD_a2/lnx_bin/sh: ./myfan.sh: not found

Why is the file not found ? Doesn't make any sense to me.

The only thing I don't follow is why sometimes calls to these sh files end with an "&". Can someone explain please ? Maybe it's connected ?

Thanks - Paul

Last edited by Panda (2007-07-09 20:16:02)

Offline

 

#17 2007-07-09 20:24:31

Panda
Member
Registered: 2007-05-15
Posts: 14

Re: Cant get myfan.sh to work

Arrrggghhh.

I cut the contents of myfan.sh and pasted it into test.sh AND IT WORKS !!

Renamed test.sh to myfan.sh, rebooted box, held my breath for a while AND IT WORKS !!

Any ideas why ?

Thanks for all your help.

Offline

 

#18 2007-07-09 21:24:34

dkl
Member
From: Toulouse
Registered: 2007-06-16
Posts: 104

Re: Cant get myfan.sh to work

Something bad in your *first* myfan.sh? Can you show the first lines?
Are you 100% sure the two files are exactly the same?
There migt be a mess between your PATH, your script, and the fact that you use "lnx_bin/sh".
I run here fun_plug with /bin/sh (i.e the file begins with "#!/bin/sh"), which is the "genuine" busybox sh, I don't use "/mnt/HD_a2/lnx_bin/sh".
Actually, I use here fonz's fun_plug, which I find very nice (you'll find it on the forum).

Can you show your $PATH either? You should have something like:

/mnt/HD_a2 # echo $PATH
/mnt/HD_a2/fun_plug.d/bin:/usr/bin:/bin:/usr/sbin:/sbin

Apparently, "myfan.sh" was searched in "/mnt/HD_a2/lnx_bin/sh", where it is *not*...

Something you must know also: in Unix, it is common for "admin" accounts NOT to put the current directory in the PATH (i.e "."). In that case, when you run a program which actually is in the current directory, you must use "./" (ex: ./test.sh). If you use only "test.sh", it will not work. *Best practice* is to use only programs which are in the "PATH". I hope it's undertandable...

Well, it works now, at least.... It took a while!

"&" has nothing to do with the problem (I think). It just runs the program in background.

  Regards

    Denis

Offline

 

#19 2007-07-10 19:36:08

Panda
Member
Registered: 2007-05-15
Posts: 14

Re: Cant get myfan.sh to work

The two files have to 100% the same, I cut and pasted the contents. I don't think it was the contents that were the problem as I was getting file not found all the time.

Again, the path must be ok as both files were in the same place.

I'm happy to just accept that it works now (and the fan is silent most of the time now big_smile), and put it down to "one of those things".

I would not have tried all your suggestions without your help, so thanks for that. It forced me to keep trying things until it was sorted.

Thanks also for explaining the "&" thing.

Thanks again - Paul

Offline

 

#20 2007-07-11 00:28:09

dkl
Member
From: Toulouse
Registered: 2007-06-16
Posts: 104

Re: Cant get myfan.sh to work

It's true that I'm happy (for you) that it works now, but I'm still not happy because it don't know the exact reason for it.
Just for information:
- can you give the first lines of your myfan.sh? Or the whole file...
- and again the (new) contents of fun_plug? Did you insert the call to myfan at the very same place, or before changing the PATH?
- result of "echo $PATH" could also help
- did you make a "diff" between your two "same" files? Sometimes, a special byte somewhere...

Normally, this things are straightforward... Even simpler than in Windoze....

Maybe we can try some other things to understand why you had this problem. I was happy to help you anyway, you're welcome.

Denis

Offline

 

#21 2007-07-11 10:44:18

dkl
Member
From: Toulouse
Registered: 2007-06-16
Posts: 104

Re: Cant get myfan.sh to work

If you still have your *faulty* "myfan.sh", can you try to run it this way:
"/bin/sh -x /mnt/HD_a2/myfan.sh" (-x is a trace option).

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB