On 8/21/06, Daniel Cid <[EMAIL PROTECTED]> wrote:

Hi Gentuxx,

Thanks for the script. I just made a small change to it so that instead
<snip>
On these lines, here is an rc.script for Slackware (and a quick
install script shell for multiple OS's where only the Slackware part
works. :) ):

#!/bin/bash
# OSSEC Scanner startup script
#
# by Jack S. Lai
#
# usage: rc.ossec { start | stop | restart | status }

# Finding where ossec is installed
. /etc/ossec-init.conf
if [ "X${DIRECTORY}" = "X" ]; then
  DIRECTORY="/var/ossec"
fi

OSSEC_CONTROL="${DIRECTORY}/bin/ossec-control"

case "$1" in
  start)
     $OSSEC_CONTROL start 1>/dev/null 2>&1
     echo "ossec started"
     ;;
  stop)
     $OSSEC_CONTROL stop 1>/dev/null 2>&1
     echo "ossec stopped"
     ;;
  status)
     $OSSEC_CONTROL status
     ;;
  restart)
     $0 stop
     $0 start
     ;;
  *)
     echo "Usage: rc.ossec { start | stop | restart | status }"
     exit 1
esac
exit 0

#!/bin/bash
# Slackware Linux = cat /etc/slackware-version
# Slackware 10.2.0

#For Slackware Installation (I put my copy in /opt/ossec and
/etc/ossec-init.conf shows it).
# /opt is where other "third party" applications reside like kde, etc...

OS[1]="/etc/redhat-release"
OS[2]="/etc/slackware-version"
OS[3]="/etc/gentoo-release"
OSMAX=3

for ((i=1; i<=${OSMAX}; ++i)); do
  CKOS="${OS[i]}"
  if [ -f $CKOS ]; then
        ACTOS=$CKOS
  fi
done

case "$ACTOS" in
  /etc/redhat-release)
  # RedHat - do RH install here:
  echo "Found RedHat version"
  ;;

  /etc/slackware-version)
  # Slackware:
  # First, has this already been done?
  if grep -q "rc.ossec" /etc/rc.d/rc.local
  then
  # No, place startup script in rc.local:
cat > /etc/rc.d/rc.local <<EOF
if [ -x /etc/rc.d/rc.ossec ]; then
 /etc/rc.d/rc.ossec start
fi
EOF
  fi
  ;;
  /etc/gentoo-release)
  # Gentoo - do Gentoo install here:
  echo "Found Gentoo version"
  ;;
esac

Reply via email to