May 25, 2010, 09:22:18 pm
News:
Pages: [1]
Print
Author Topic: The OSD "rc" file. (How to run something on startup)  (Read 185 times)
pfft2001
Full Member
***
Posts: 145


View Profile
« on: May 06, 2010, 09:33:23 am »

Could someone remind me what the procedure is for adding a (Unix) command to the startup sequence?

Which file do you edit?  What are the "no-nos"/gotchas?

(I'm familiar with the general idea - have done many custom "rc" files on "regular" Linuxes.  Does the OSD use the usual Sxx/Kxx scheme, or is it [as I suspect] all just in one file?)
Logged
greyback
Administrator
Hero Member
*****
Posts: 1500


View Profile
« Reply #1 on: May 09, 2010, 06:06:00 am »

Hey,
you can add commands to startup by creating/editing this shell script:
/mnt/OSD/rc.user

I've used it for many years now, it's great for having your OSD auto-mount network shares on startup. The only thing I found was needing to delay these commands by about 5 seconds (i.e. stick in a "sleep 5;") or else they didn't succeed - I think networking wasn't fully up when rc.user is called.

OSD has the usual rc scripts for startup, explore /etc/init.d and /etc/rcX.d. There are no shutdown scripts tho, if I remember correctly.
-G
Logged
pfft2001
Full Member
***
Posts: 145


View Profile
« Reply #2 on: May 09, 2010, 10:33:17 am »

Thanks.
Logged
pfft2001
Full Member
***
Posts: 145


View Profile
« Reply #3 on: May 21, 2010, 12:53:30 pm »

Hey,
you can add commands to startup by creating/editing this shell script:
/mnt/OSD/rc.user

I've used it for many years now, it's great for having your OSD auto-mount network shares on startup. The only thing I found was needing to delay these commands by about 5 seconds (i.e. stick in a "sleep 5;") or else they didn't succeed - I think networking wasn't fully up when rc.user is called.

OSD has the usual rc scripts for startup, explore /etc/init.d and /etc/rcX.d. There are no shutdown scripts tho, if I remember correctly.
-G

I finally got around to messing with this today, and it works.  I set up that script to mount my network shares and to do a time sync.  I have a few comments and questions (feel free to enjoy the comments, but be sure to answer the questions...):

1) The mounting of network shares via the rc.user file does work.  At least, I can say that they come up in green in the interface - and seem to all the world to be mounted.  The acid test, of course, is to see if my overnight recording works.  I have a vague memory of having tried this in the past, and having it look OK during the day, but the overnight recording still bombed (until I went in an manually clicked on them).  I will report back tomorrow on this.

2) What is the recovery if I screw this up?  I.e., what if I put something in there that hangs the boot?  This has hasn't happened yet (knock wood), but everytime you change the file and reboot, your heart skips a beat hoping that it will come back up.  Now I that I think about it, I think you should still be able to telnet at this point and fix it.  Is that right?

2a) Note that a "Emergency Firmware Upgrade" wouldn't help, because the nice thing about the EFU is that it *doesn't* reset your settings.  That is, as far as I can tell, it doesn't reset the contents of /mnt/OSD.

3) When exactly in the boot process does this script run?  I think it is when the phrase "The power of freedom - Neuros" is onscreen.  Is that right?  I think I detect a (much) longer than normal pause at this point now.  Note that this is the second "The power of freedom" message - the first one doesn't mention "Neuros".

4) It worked fine the first time for mounting shares, but the time sync didn't work.  I figured out that the problem was that the OSD must be reading the time from the onboard clock *after* running the rc.user script (can you confirm this?).  I.e., my time sync *was* working, but it was getting overwritten by a later process.  Note that the battery on my OSD is shot; on every boot, my time gets reset to 1/1/70@12:00 AM.  I changed the line in the rc file that does the time sync to something like:

(sleep 30;...) &

to "fork off" that process and do it 30 seconds later.  That seems to be working (yey!)

5) Note, just FYI, that the first line of my rc.user script is: exec > /tmp/rcuser.out 2>&1
This seems like a good idea for everyone.  There isn't any other way to see the output of the script, is there?
Logged
greyback
Administrator
Hero Member
*****
Posts: 1500


View Profile
« Reply #4 on: May 21, 2010, 05:54:35 pm »

Hi,
glad you've got it working! Comments:
1. It should work just fine, it's what I've used for years now.
2. Recovery... well unless you stick a "killall telnetd" into a bootscript, or fiddle with the network settings, telnet should always come up. Worst case, you use the serial cable to access the OSD's serial console & fix things that way.
3. I cannot say for sure exactly when rc.user is run. It should be the final bootscript executed, so my estimate is just before the menu becomes available.
4. Many of the bootscripts are executed in parallel, so it's possible the time is being reset after you fix it. Replacing the battery in the OSD isn't an option, no? (Standard PC motherboard battery I think).
5. Yes I use this for debugging too. "dmesg" shows only kernel-related messages.
-G
Logged
pfft2001
Full Member
***
Posts: 145


View Profile
« Reply #5 on: May 21, 2010, 06:02:35 pm »

Re: replacing the battery.  I think you suggested that once before.

Can I do without breaking anything (I.e. without "voiding my warranty", as they say...)

Anyway, I'm not all that concerned - as long as I have my workaround (the 30 second delay...)
Logged
greyback
Administrator
Hero Member
*****
Posts: 1500


View Profile
« Reply #6 on: May 21, 2010, 06:13:12 pm »

Heh, sorry for repeating myself Smiley

I can't say for sure, I but very much doubt Neuros would deny you your warranty for replacing the CMOS battery.

FYI, screws of case are under the rubber feet. They're standard Phillips screws too. It's easy to get into.
-G
Logged
pfft2001
Full Member
***
Posts: 145


View Profile
« Reply #7 on: May 22, 2010, 04:21:13 pm »

Hi,
glad you've got it working! Comments:
1. It should work just fine, it's what I've used for years now.
-G

Yup.  It works fine.

P.S.  I'll take a look at opening the case and replacing the battery...
Logged
Pages: [1]
Print
Jump to: