#!/bin/bash if [ $# != 1 ] ; then echo "Usage: $0 (start|stop|restart)" exit 1 fi SERVERS="xinetd dhcpd portmap nfs" DEVNFS=/dev/nfs EXPORTS="/tftpboot /home /root /usr /usr/local" # Controlla se il device per il filesystem in nfs esiste if [ ! -c $DEVNFS ] ; then echo "Don't find $DEVNFS: try 'mknod /dev/nfs c 0 255'" exit 1 fi # Controllo se gli exports sono corretti if [ ! -e /etc/exports ] ; then echo "don't find /etc/exports!" exit 1 fi for i in $EXPORTS ; do if [ -z $( cat /etc/exports | awk {'print $1'} | grep "$i" ) ] ; then echo "Don'r find entry $i in /etc/exports!" exit 1 fi done # Controlla se il TFTP e' attivato if [ ! -e /etc/xinetd.d/tftp ] ; then echo "don't find /etc/xinetd.d/tftp!" exit 1 fi if [ -z $( cat /etc/exports | awk {'print $1'} | grep "$i" ) ] ; then echo "Don't find entry $i in /etc/exports!" exit 1 fi if [ -z $( cat /etc/xinetd.d/tftp | grep disable | grep no \ | awk {'print $1'} ) ] ; then echo "TFTP server cannot start for /etc/xinetd.d/tftp configuration!" exit 1 fi for i in $SERVERS ; do /etc/init.d/$i $1 done echo "Done." exit 0