#!/bin/sh # # Startup script for LISa # # chkconfig: 345 92 8 # description: Starts and stops the LAN Information Server used \ # to provide a LAN browser. # processname: lisa # # based on rclisa Version 0.1 # 2001 by Marcus Thiesen (marcus@thiesenweb.de) for SuSE Linux 7.1 # This is free and comes with absolutely no WARRANTY # adapted for Mandrake 8.0 by Patrick Alberts (mandrake@alberts.org) # Updated for Mandrake 9.0 by Buchan Milne (bgmilne@linux-mandrake.com) CONFIG_FILE=/etc/lisarc prog="lisa" # Source function library. if [ -f /etc/init.d/functions ] ; then . /etc/init.d/functions elif [ -f /etc/rc.d/init.d/functions ] ; then . /etc/rc.d/init.d/functions else exit 0 fi # Get config. . /etc/sysconfig/network # Check that networking is up. if [ ${NETWORKING} = "no" ] then exit 0 fi # check how we were called case "$1" in start) PID=`pidof -s lisa` if [ -z "$PID" ]; then if [ -e /usr/bin/lisa ]; then #check for config file, if not, generate it: if [ ! -e $CONFIG_FILE ]; then NOTFIRST=0 IPNMS="" for i in `seq 0 9`;do if [ -f /etc/sysconfig/network-scripts/ifcfg-eth$i ];then IPNM=`/sbin/ifconfig eth$i| awk '/inet addr/ {print $2 ":" $4}' | awk 'BEGIN{FS=":"} {print $2"/" $4 ""}'` IPNMS=`gprintf "%s"\n" "$IPNMS"$IPNM;"` NOTFIRST=1 fi done [ $NOTFIRST ] && gprintf "No config file, generating one, please run kcontrol as root to customise\n" [ $NOTFIRST ] && echo -e "AllowedAddresses=$IPNMS\nBroadcastNetwork=$IPNMS\nDeliverUnnamedHosts=0\nFirstWait=30\nMaxPingsAtOnce=256\nPingAddresses=\nPingNames=\nSearchUsingNmblookup=1\nSecondWait=-1\nUpdatePeriod=300" > $CONFIG_FILE fi if [ -e $CONFIG_FILE ]; then action "Starting %s: " "$prog" /bin/true /usr/bin/lisa -c $CONFIG_FILE >/dev/null 2>&1 else action "No configuration available, not starting LISa" /bin/false fi else action "Starting %s: binaries not found " "$prog" /bin/false fi else action "Starting %s: already running (%s) " "$PID" "$prog" /bin/false fi touch /var/lock/subsys/lisa ;; stop) PID=`pidof -s lisa` if [ "$PID" ]; then action "Stopping %s: " "$prog" kill -3 $PID fi rm -f /var/lock/subsys/lisa ;; status) PID=`pidof -s lisa` if [ "$PID" ]; then gprintf "%s is running! ($PID)\n" "$prog" kill -SIGUSR1 $PID; sleep 3 else gprintf "%s is not running!\n" "$prog" ; fi ;; restart) $0 stop && $0 start ;; refresh) PID=`pidof -s lisa` if [ "$PID" ]; then gprintf "Sending %s a SIGHUP ($PID)\n" "$prog" kill -SIGHUP $PID; else gprintf "%s is not running!\n" "$prog" ; fi ;; *) gprintf "usage: %s {start|stop|status|refresh|restart}\n" $0 ;; esac exit 0