Mailinglist Archive: opensuse (3637 mails)

< Previous Next >
multiple startproc II
  • From: "S.Toms" <smotrs@xxxxxxxxxxxxxx>
  • Date: Thu, 17 May 2001 23:19:28 -0700 (PDT)
  • Message-id: <Pine.LNX.4.21.0105172233410.898-100000@xxxxxxxxxxxxxxxxxxx>
Hey again, well, with the assistance of Tor Sigurdsson and the idea he
had of the following

start)
echo -n "Starting service PortSentry: "
case $PORTSENTRY_MODE in
basic)
TSENPROC="$PORTSENTRY -tcp"
USENPROC="$PORTSENTRY -udp"
;;
stealth)
TSENPROC="$PORTSENTRY -stcp"
USENPROC="$PORTSENTRY -sudp"
;;
advanced)
TSENPROC="$PORTSENTRY -atcp"
USENPROC="$PORTSENTRY -audp"
;;
*)
echo "Unknown mode"
exit 1
;;
esac
startproc $TSENPROC
startproc $USENPROC
;;

which, though I liked, didn't work due to the way startproc looks for
running procs and the nature of the version of startproc installed with
7.0 not having the -f for force. So I took startproc completly out of the
loop altogether since killproc still finds and kills them correctly when
launched like the following

$PORTSENTRY -tcp
$PORTSENTRY -udp

so I moved the modes to a variable depending on the result of
$PORTSENTRY_MODE, and ran them through a for loop like the following

start)
echo -n "Starting service PortSentry: "
case $PORTSENTRY_MODE in
basic)
MODES="tcp udp"
;;
stealth)
MODES="stcp sudp"
;;
advanced)
MODES="atcp audp"
;;
*)
echo "Unknown mode"
exit 1
;;
esac
for i in $MODES; do
$PORTSENTRY -$i && echo -n "$i: OK " || echo -n "$i: Fail "
done
echo -e "$return"
;;


but, I'm hopeing someone else will have a better suggestion for the mode
notice I'm currently using (4th line from the bottom), which looks rather
ugly. I'd like some way of knowing that the modes worked, rather then it
just saying

Starting service PortSentry: done

because when I was using startproc, it would start one mode, but not the
second and there was no way of telling without looking at the results of a
`ps -ax` that it didn't work, so, any thoughts?? :)

--
S.Toms - smotrs@xxxxxxxxxxxxxx - www.mindspring.com/~smotrs
SuSE Linux v7.0+ - Kernel 2.2.18

"...and the fully armed nuclear warheads, are, of course, merely a
courtesy detail."




< Previous Next >
This Thread
  • No further messages