ECS Home Automation and Security Archives
  learn more | view messages for this month | NetBloc® | terms of use | search

Google
 


  subject (prev) or (next) | time (prev) or (next) | author (prev) or (next) | view more subjects

Subject:
From:
Date:
RE: [ecs] *brutally* stumped by /etc/profile behavior in Knoppix
Rob Hicks
Wed, 25 Feb 2004 09:33:05 -0700

Hi Mark.

I would like to suggest a different way of handling ECS on Linux. Here's my
reasoning. 

ECS consists of a server and one or more client browsers. The server can be
started up without Xwindows. Therefore, the ECS server could be started in
any suitable run level, most likely run level 3 or 5. For embedded servers
(ones without a display), ECS should be started in run level 3. 

The client portion of ECS requires a browser. The browser may reside on any
machine that has access to the network running ECS. On Linux, ECS will
obviously require a browser that supports java, and of course Xwindows. Thus
using a browser to access ECS on Linux will require that the Linux box run
at run level 5.

Using UNIX standards, ECS would have an init script, usually stored in
/etc/rc.d/init.d/. The init script would normally have start, stop, restart
and status parameters. On boxes where ECS is expected to run as both a
server and client, ECS should not start unless the system is in run level 5.
On boxes where ECS is only a server, ECS should not start unless the system
is in run level 3.

The ECS init script can take advantage of chkconfig for init script
mangagement. Chkconfig manages init scripts for the various run levels. A
suitable ECS startup script might be as follows:
---------------------------------------------------------------------------
#!/bin/sh
#---------------------------------------------------------------
# Module          : initscripts
# File            : ecs
# Author          : Rob Hicks
# Created On      : Wed February 25, 2004
#---------------------------------------------------------------
# chkconfig: 35 99 09
# description: This startup script launches ECS.
#---------------------------------------------------------------

# Source function library.
. /etc/rc.d/init.d/functions

ret=0

case $1 in 
    start)
	gprintf "Starting ECS: "
	/opt/ecs/ecs.bin &
	success "ECS startup"
	ret=$?
	echo
	if [ $ret = 0 ]; then
	  touch /var/lock/subsys/ecs
	fi
	;;

    stop)
	gprintf "Stopping ECS: "
	if [ -r /var/lock/subsys/ecs ]; then
	    kill `cat /var/lock/subsys/ecs` > /dev/null 2>&1
	fi
	ret=$?
	echo
	if [ $ret = 0 ]; then
	    success "ECS shutdown"
	    rm -f /var/lock/subsys/ecs
	else
	    failure "ECS shutdown"
	    rm -f /var/lock/subsys/ecs
	fi
	;;

    status)
	status ecs
	;;

    reload)
	;;

    restart)
	$0 stop
	$0 start
	ret=$?
	;;
    *)
	gprintf "Usage: %s\n" "$(basename $0) {start|stop|restart|status}"
	exit 0
	;;
esac

exit $ret

# ecs ends here

This script will start ecs in the background without the need to open a
Xwindows console. Of course, this script won't work right now because
ecs.bin is calling linux_browser_startup.sh, which is starting mozilla and
loading the ECS init.htm page before a user has logged in. So, as currently
configured, ECS can't be run as a server only, something that I would really
like it to do because I don't need or want to run Xwindows. Xwindows uses a
lot of resources, especially for an embedded server.

Note one line in the script in particular, the one that begins with: 

       # chkconfig: 35 99 09

This allows the ECS init script to be managed by chkconfig. This lines tells
chkconfig that the script can be added to run levels 3 and 5, that its
startup sequence should be 99 and that its kill sequence should be 09. You
would probably never use the kill sequence, but most scripts allow them. If
you want ecs to be loadable only in run level 5, you could change the
chkconfig line as follows:  # chkconfig: 5 99 09

The appropriate startup script for a box acting as both a server and a
client, can be added to run level 5, /etc/rc.d/rc5.d/, with the following
chkconfig command.

	chkconfig --level 5 ecs on

By starting ECS at startup sequence 99, you can be assume that Xwindows has
started. Of course, that doesn't solve the browser problem, but if you want
to start a browser for the user, you can do so by adding it to the user's
startup scripts or you could simply add an icon to the user's desktop, etc.

The appropriate startup script for run level 3 can be added using chkconfig
to /etc/rc.d/rc3.d/ with the following chkconfig command.

	chkconfig --level 3 ecs on

I hope you'll consider those of us who may want to run ECS as solely a
server on a linux box. Maybe there is only one of us so it doesn't matter:-)

Regards,
Rob
rob.hicks@comcast.net
-----Original Message-----
From: Mark Gilmore [mailto:mark@OmnipotenceSoftware.com] 
Sent: Wednesday, February 25, 2004 7:16 AM
To: ecs@netbloc.com
Subject: [ecs] *brutally* stumped by /etc/profile behavior in Knoppix

When the "knoppix" user is logged at in boot up, /etc/profile is executed.
I am trying to make it execute ecs in a terminal window (xterm, konsole,
etc).

My /etc/profile command is:
         /home/knoppix/startup.sh &

startup.sh:
         cd /home/knoppix
         sleep 120 (wait to *assure* that X-windows has started)
         xterm -e ecs.bin & > trace.lis 2>&1
         ps -aux > trace.lis

I *know* that startup.sh *is* executing, as I have traced the execution of 
every line.
But the xterm command does *nothing*.
It reports *no* errors.
The process list shows *no* xterm.
ecs.bin is *not* executed (no logs exist).
If I manually execute startup.sh, it works fine.
??????
Thanks,

Mark Gilmore
http://OmnipotenceSoftware.com 


  subject (prev) or (next) | time (prev) or (next) | author (prev) or (next) | view more subjects




Services provided by [NetBloc]®! NetBloc Solutions Inc.
Terms of use. Indexing software (c) 1999 Lin-De, Inc
.