On Fri, 18 Mar 2005 09:46 am, Voytek wrote: > <quote who="James Gray"> > > > On Fri, 18 Mar 2005 08:29 am, Voytek wrote: > >> how can I put a simple script to log date/time of any reboots ? > > > > Add a K??log_reboot script to /etc/rc6.d (or find where the rc?.d > > directories > > are on your system). > > > > Run level 6 is "reboot". Run level 0 is "shutdown/halt". You may want > > to add > > a K??log_shutdown to /etc/rc0.d too. > > > > In these scripts, just have a simple message that is sent to the system > > log: > > > > #!/bin/bash > > /usr/bin/logger "Rebooting system at $(/bin/date)" > > # end script > > James, > > would these scripts still execute for 'unknow reason self-reboot' ? > > at this time, it seems I have some problem causing the machine to 'self > reboot'
Depends how the server was rebooted. If you mean "as a result of a kernel panic" from memory exhaustion, then no. When the kernel panics all bets are off, it's usually a messy shutdown requiring filesystems to be checked when it comes back up etc. If OTOH, if "init" gets it's tits in a tangle and decides to reboot, then yes, all the "rc6.d" scripts will be executed. (I've seen this on Solaris - but never Linux...not saying it can't happen though. I think it requires a watchdog program etc). Although, if it's clean reboot/shutdown then "last" will show you all the info you are looking for. James -- Blood flows down one leg and up the other. -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
