Can you chance the instance of echo that are for informational messages to be logmsg instead? That why they'll also work with syslog.
-Sean
On Sat, Mar 26, 2005 at 08:28:44AM -0800, [EMAIL PROTECTED] wrote:
> Update of /cvsroot/systemimager/systemimager/initrd_source/skel/etc/init.d
> In directory
> sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10690/initrd_source/skel/etc/init.d
>
> Modified Files:
> functions
> Log Message:
> added commands to monitor the clients installation with si_monitor tool
>
> Index: functions
> ===================================================================
> RCS file:
> /cvsroot/systemimager/systemimager/initrd_source/skel/etc/init.d/functions,v
> retrieving revision 1.69
> retrieving revision 1.70
> diff -u -d -r1.69 -r1.70
> --- functions 26 Mar 2005 13:38:30 -0000 1.69
> +++ functions 26 Mar 2005 16:28:32 -0000 1.70
> @@ -170,6 +170,9 @@
> echo "SSH_DOWNLOAD_URL=$SSH_DOWNLOAD_URL" >> /tmp/variables.txt
>
> echo "FLAMETHROWER_DIRECTORY_PORTBASE=$FLAMETHROWER_DIRECTORY_PORTBASE"
> >> /tmp/variables.txt
> +
> + echo "MONITOR_SERVER=$MONITOR_SERVER" >> /tmp/variables.txt
> + echo "MONITOR_PORT=$MONITOR_PORT" >> /tmp/variables.txt
> }
> #
>
> ################################################################################
> @@ -239,6 +242,9 @@
> # Usage: $COMMAND || shellout
> #
> shellout() {
> + if [ ! -z $MONITOR_SERVER ]; then
> + stop_report_task -1
> + fi
> COUNT="$RETRY"
> logmsg "Killing off running processes."
> kill -9 $TMPFS_WATCHER_PID >/dev/null 2>/dev/null
> @@ -1266,6 +1272,70 @@
> #
>
> ################################################################################
> #
> +# Report installation status to the monitor server
> +#
> +
> +start_report_task() {
> + # Evaluate image size.
> + IMAGESIZE=`rsync -av $IMAGESERVER::$IMAGENAME | grep "total size" | sed
> -e "s/total size is \([0-9]*\).*/\1/"`
> + IMAGESIZE=`expr $IMAGESIZE / 1024`
> +
> + if [ -z $MONITOR_PORT ]; then
> + MONITOR_PORT=8181
> + fi
> +
> + # Evaluate disks size.
> + LIST=`df 2>/dev/null | sed -ne "/^\/dev/p" | sed "s/ */ /g" | sed
> "s/\(.*\) \(.*\) \(.*\) \(.*\) \(.*\) \(.*\)/\3+/"`0
> + DISKSIZE=`echo $LIST | bc`
> +
> + # MAC address is the primary key to identify a client -AR-
> + mac=`ifconfig $DEVICE | sed -ne "s/.*HWaddr //p" | sed "s/ //g" | sed
> s/:/./g`
> +
> + # Spawn the report task -AR-
> + {
> + while :; do
> + LIST=`df 2>/dev/null | sed -ne "/^\/dev/p" | sed "s/ */ /g" | sed
> "s/\(.*\) \(.*\) \(.*\) \(.*\) \(.*\) \(.*\)/\3+/"`0
> + TOT=`echo $LIST | bc`
> + status=`echo "($TOT - $DISKSIZE) * 100 / $IMAGESIZE" | bc`
> + if [ $status -eq 0 ]; then
> + status=1
> + fi
> +
> + # Send status to the monitor server -AR-
> + time=`cat /proc/uptime | sed "s/\..*//"`
> + tmpfs=`df | grep tmpfs | sed "s/.* \([0-9]*%\) .*/\1/"`
> + msg=`echo mac=$mac:tmpfs=$tmpfs:time=$time:status=$status`
> + echo $msg | nc $MONITOR_SERVER $MONITOR_PORT
> +
> + # Wait 10 sec between each report -AR-
> + sleep 10
> + done
> + }&
> + REPORT_PID=$!
> +}
> +#
> +################################################################################
> +#
> +# Stop to report installation status to the monitor server
> +#
> +
> +stop_report_task() {
> + status=$1
> + kill -9 $REPORT_PID
> +
> + if [ -z $MONITOR_PORT ]; then
> + MONITOR_PORT=8181
> + fi
> +
> + # Try to report the error to the monitor server.
> + mac=`ifconfig $DEVICE | sed -ne "s/.*HWaddr //p" | sed "s/ //g" | sed
> s/:/./g`
> + time=`cat /proc/uptime | sed "s/\..*//"`
> + msg=`echo mac=$mac:time=$time:status=$status`
> + echo $msg | nc $MONITOR_SERVER $MONITOR_PORT
> +}
> +#
> +################################################################################
> +#
> # Beep incessantly
> #
> beep_incessantly() {
>
>
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> systemimager-cvs-commits mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/systemimager-cvs-commits
>
--
__________________________________________________________________
Sean Dague Mid-Hudson Valley
sean at dague dot net Linux Users Group
http://dague.net http://mhvlug.org
There is no silver bullet. Plus, werewolves make better neighbors
than zombies, and they tend to keep the vampire population down.
__________________________________________________________________
pgpPdylBzfg4M.pgp
Description: PGP signature
