PDA

Bekijk de volledige versie : pre-shutdown doesn't work



greengreen
26-05-2007, 19:52
Hi, I created file /usr/local/sbin/pre-shutdown
with code
printf blah >> /opt/var/example

after chmod +x /usr/local/sbin/pre-shutdown

but when I reboot router nothing happend.
Where is bug?

thanks o lot

wengi
27-05-2007, 09:34
Did you save the flashfs?
It normaly should work this way...

greengreen
27-05-2007, 11:34
yes i did
flashfs enable
flashfs save
flashfs commit

and after reboot there is file pre-shutdown

Can you try it on your router?
Thanks very much

wengi
27-05-2007, 12:38
This is working for me!
This is my pre-shutdown:
#!/bin/sh
# write a log line:
logger "pre-shutdown starting"

# write a log line:
echo "rtc-time is set to `/bin/date '+%Y:%m:%d:%w:%H:%M:%S'`" | logger -t pre-shutdown
# set time:
/bin/date +%Y:%m:%d:%w:%H:%M:%S > /dev/rtc

i see the lines in syslog and time is saved correctly.

Tamadite
27-05-2007, 14:50
you wrote wrong flashfs sequence. It should be:


flashfs save
flashfs commit
flashfs enable

greengreen
27-05-2007, 15:46
Thank a lot ,now is running perfectly.
I have another question. What is doing this your script and whot is rtc?

thanks(maybe it is same script what i wanted to do ;))

wengi
27-05-2007, 17:05
It is for the Real Time Clock (http://wl500g.info/showthread.php?t=1642) of the WL-HDD.
With WL-HDD it is not necesarry to get time with ntp. It has its own RTC (Hardware!).

Very usefull for people using the WL-HDD in a car.

wengi

greengreen
27-05-2007, 17:09
thanks I have 500gx and my problem is that when my internet conection is off and I reboot router then isn't possible to get real time from internet.And it is bad for wl conection and for statistic vnstat, rrdtool which use this bad time of year 1970.
Maybe I could use your script too. but problem is with insmod /opt/lib/modules/2.4.20/rtc3.o - can't load

wengi
27-05-2007, 17:24
What happens if you sync manualy? Try
ntpclient -l -h ptbtime1.ptb.de -c l -s

Using rtc.o will ONLY work on WL-HDD. All other routers are missing the hardware!!!

greengreen
27-05-2007, 17:58
yes
ntpclient -l -h ptbtime1.ptb.de -c l -s is runing but only when is internet conected. When internet is off then : ptbtime1.ptb.de: Unknown host

wengi
27-05-2007, 18:04
well. of course. If you want to sync time over internet you have to be connected to the internet. No hands - no cookies!

But i think your problem is that the WL does not sync at all...

greengreen
27-05-2007, 18:12
no i would like to set time and date sometime when internet is off. :( But it isn't possible about. For example:
I reboot router and internet is off. After reboot is date 01.01.1970 and I would like to set time(automaticly) without internet (because internet can be off).On the right time depends a few others scripts.

Tamadite
27-05-2007, 21:02
what about "date"?


date -s 052721532007

Should set the clock system to:


Sun May 27 21:53:00 MESZ 2007

wengi
28-05-2007, 13:09
no i would like to set time and date sometime when internet is off. :( But it isn't possible about. For example:
I reboot router and internet is off. After reboot is date 01.01.1970 and I would like to set time(automaticly) without internet (because internet can be off).On the right time depends a few others scripts.

And you want this automatically? Where should your router get the time from? Wizard of OZ?

Sorry, but you need a time source! No souce - no time.

wengi