summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorankry2003-05-07 23:35:21 (GMT)
committercvs2git2012-06-24 12:13:13 (GMT)
commit953dd36ed2a573c2cf81718ea0fc913fbe6b6a01 (patch)
tree24e43a3d486391abbb817d547e074df7f50f75b8
parent03b45cf0b5ae81edd50f496a439985fe9033fb1b (diff)
downloadportsentry-953dd36ed2a573c2cf81718ea0fc913fbe6b6a01.zip
portsentry-953dd36ed2a573c2cf81718ea0fc913fbe6b6a01.tar.gz
- cleaning
Changed files: portsentry.init -> 1.3
-rw-r--r--portsentry.init79
1 files changed, 42 insertions, 37 deletions
diff --git a/portsentry.init b/portsentry.init
index d723689..3811a9c 100644
--- a/portsentry.init
+++ b/portsentry.init
@@ -1,14 +1,14 @@
#! /bin/sh
#
-# portsenry Start the portsentry Port Scan Detector
+# portsenry Start the portsentry Port Scan Detector
#
-# chkconfig: 345 98 05
-# description: Portsentry Port Scan Detector is part of the Abacus Project \
-# suite of tools. The Abacus Project is an initiative to release \
-# low-maintenance, generic, and reliable host based intrusion \
-# detection software to the Internet community.
-# processname: portsentry
-# pidfile: /var/run/portsentry.pid
+# chkconfig: 345 98 05
+# description: Portsentry Port Scan Detector is part of the Abacus Project \
+# suite of tools. The Abacus Project is an initiative to release \
+# low-maintenance, generic, and reliable host based intrusion \
+# detection software to the Internet community.
+# processname: portsentry
+# pidfile: /var/run/portsentry.pid
# Source function library
@@ -21,9 +21,13 @@
[ -f /etc/sysconfig/portsentry ] && . /etc/sysconfig/portsentry
# Check that networking is up.
-if [ "${NETWORKING}" = "no" ]; then
- echo "WARNING: Networking is down. Portsentry service can't be runed."
- exit 1
+if is_yes "${NETWORKING}"; then
+ if [ ! -f /var/lock/subsys/network ]; then
+ msg_network_down Portsentry
+ exit 1
+ fi
+else
+ exit 0
fi
[ -f /usr/bin/portsentry ] || exit 0
@@ -31,47 +35,48 @@ fi
# Check the modes we're running in...
unset allmodes;
is_yes "$PORTSENTRY_ATCP"; [ "$?" = 1 ] || {
- PORTSENTRY_TCP="0";
- PORTSENTRY_STCP="0";
- allmodes=" -atcp";
- }
+ PORTSENTRY_TCP="0";
+ PORTSENTRY_STCP="0";
+ allmodes=" -atcp";
+}
is_yes "$PORTSENTRY_AUDP"; [ "$?" = 1 ] || {
- PORTSENTRY_UDP="0";
- PORTSENTRY_SUDP="0";
- allmodes="$allmodes -audp";
- }
+ PORTSENTRY_UDP="0";
+ PORTSENTRY_SUDP="0";
+ allmodes="$allmodes -audp";
+}
is_yes $PORTSENTRY_TCP; [ "$?" = 1 ] || allmodes="$allmodes -tcp";
is_yes $PORTSENTRY_UDP; [ "$?" = 1 ] || allmodes="$allmodes -udp";
is_yes $PORTSENTRY_STCP; [ "$?" = 1 ] || allmodes="$allmodes -stcp";
is_yes $PORTSENTRY_SUDP; [ "$?" = 1 ] || allmodes="$allmodes -sudp";
+
case "$1" in
start)
# Check if the service is already running?
for mode in $allmodes; do
- if [ ! -f /var/lock/subsys/portsentry$mode ]; then
- msg_starting "portsentry$mode"
- daemon "portsentry $mode"
- RETVAL=$?
- [ $RETVAL -eq 0 ] && touch /var/lock/subsys/portsentry$mode
- else
- msg_Already_Running portsentry
- exit 1
- fi
- done
+ if [ ! -f /var/lock/subsys/portsentry$mode ]; then
+ msg_starting "portsentry$mode"
+ daemon "portsentry $mode"
+ RETVAL=$?
+ [ $RETVAL -eq 0 ] && touch /var/lock/subsys/portsentry$mode
+ else
+ msg_already_running portsentry
+ exit 1
+ fi
+ done
;;
stop)
- # Stop daemons.
+ # Stop daemons.
cd /var/lock/subsys/;
ls --color=none /var/lock/subsys/portsentry* >/dev/null 2>&1
[ $? -eq "0" ] || {
- msg_Not_Running portsentry
- exit 1
- }
+ msg_not_running portsentry
+ exit 1
+ }
msg_stopping portsentry
- killproc portsentry
- rm -f /var/lock/subsys/portsentry* >/dev/null 2>&1
+ killproc portsentry
+ rm -f /var/lock/subsys/portsentry* >/dev/null 2>&1
rm -f /var/run/portsentry.pid /var/run/portsentry.loc* >/dev/null 2>&1
;;
status)
@@ -82,8 +87,8 @@ case "$1" in
$0 start
;;
*)
- msg_usage "$0 {start|stop|status|restart|reload}"
+ msg_usage "$0 {start|stop|restart|reload|status}"
exit 1
esac
-exit 0
+exit $RETVAL