[comp.sources.d] mazewar starter script

root@libove.UUCP (Jay M. Libove) (10/02/88)

A trivial startup script for the recently posted multi user system V
mazewar game, to avoid having to run the mazedaemon in the /etc/rc.

With /usr/games/mazewar below, and /usr/games/lib/maze{war,daemon}
installed, with the mazedaemon root owned games (or whatever) group, and
assuming that your "ps -e" returns only the first eight characters of an
executing command line... (tune this as necessary; run the mazedaemon
and do a "ps -e" and see how much of "mazedaemon" you get)

: use /bin/sh
# determine if the mazedaemon is already running
daemon=`ps -e | awk '/mazedaem$/ { print $1 }'`
# if not (that is, if the awk comes back not (not empty)) then run the daemon
if [ ! -n "$daemon" ]
then	/usr/games/lib/mazedaemon &
fi
# exec the game itself
exec /usr/games/lib/mazewar $*

-- 
Jay Libove		ARPA:	jl42@andrew.cmu.edu or libove@cs.cmu.edu
5731 Centre Ave, Apt 3	BITnet:	jl42@andrew or jl42@drycas
Pittsburgh, PA 15206	UUCP:	uunet!nfsun!libove!libove or
(412) 362-8983		UUCP:	psuvax1!pitt!darth!libove!libove