1# Configure script for Samba.swat 2 3UPDATE=0 4 5KillProcess() 6{ 7 proc=$1 8 sig=$2 9 10 # Determine PID of process(es) to stop and kill it. This routine 11 # is designed to work with bourne shell, ksh and posix shell. 12 13 Command=`basename $proc | cut -c1-8` # Solaris ps limited to 8 chars. 14 15 pid=`ps -e | awk "\\$NF~/$Command/ {print \\$1}"` 16 17 if [ "X$pid" != "X" ]; then 18 kill -$sig $pid 19 fi 20} 21 22UpdateServices() 23{ 24 if grep -q '^swat' /etc/services 25 then 26 return 27 fi 28 29 echo "swat 901/tcp" >>/etc/services 30 cat <<__EOF__ 31NOTE: The following entry had been added to /etc/services: 32 swat 901/tcp 33 Should you want to move SWAT to another port, modify the entry 34 accordingly and restart inetd daemon with -HUP signal. 35__EOF__ 36 UPDATE=1 37} 38 39UpdateInetd() 40{ 41 if grep -q '^swat' /etc/inetd.conf 42 then 43 return 44 fi 45 46 echo "swat stream tcp nowait.400 root /opt/samba/bin/swat swat" >>/etc/inetd.conf 47 48 49 UPDATE=1 50} 51 52UpdateServices 53UpdateInetd 54 55if [ "$UPDATE" -eq 1 ] 56then 57 KillProcess inetd HUP 58fi 59 60exit 0 61 62