#! /bin/bash
# $Id: logRunLevel,v 1.3 2004/04/21 16:25:26 tom Exp $
# $Source: /home/CVS/fireballTop/fireballFS/root/etc/init.d/logRunLevel,v $
#
# logRunLevel:
#
# Script designed to allow tracking of init's runlevels through a 
# simple file read.  A link to this scripts must be placed as an
# early symlink in each of the run levels we want to detect.
# That would be levels:
#
#   0 : shutdown
#   3 : startup (innit begins here)
#   4 : progression from 3
#   5 : progression from 4 => final runtime level
#   6 : restart level
#
# In all but runlevel 3 the symlink can be the very first item.
# But in runlevel 3, the first item has to be the mountall command.
# This is required because the file to which we log the run level 
# is located on one of the mounted partitions (in /var/run), which
# isn't accessible until after the mounts are done.
#
# The symlinks in each level need to have distinct names, like
#   S00logRunLevel3 , S00logRunLevel4, etc.
# Otherwise the /etc/init.d/rc script that handles the runlevels 
# will attempt to skip the subsequent calls.  See the comments in
# that script.
# 
# Formerly logRunLevel saved the information in a file which had to 
# be opened and read whenever anybody wanted the information.  In
# particular, frontpanel_task has to read the file every second.  
# This has been replaced by saving the information in the
# kernel-resident gpsdata database.  The sysinfo command is now used to
# write the information into that shared database.

#echo "Runlevel = $RUNLEVEL"
#echo "Called as $0"
/usr/local/fireball/sysinfo -s runlevel $RUNLEVEL
