X-Git-Url: http://ftp.carnet.hr/pub/carnet-debian/scm?a=blobdiff_plain;ds=sidebyside;f=src%2Finit%2Fossec-hids-alpine.init;fp=src%2Finit%2Fossec-hids-alpine.init;h=fd08d0b408351651d8ec7031cb9818845f28b9d2;hb=3f728675941dc69d4e544d3a880a56240a6e394a;hp=0000000000000000000000000000000000000000;hpb=927951d1c1ad45ba9e7325f07d996154a91c911b;p=ossec-hids.git diff --git a/src/init/ossec-hids-alpine.init b/src/init/ossec-hids-alpine.init new file mode 100644 index 0000000..fd08d0b --- /dev/null +++ b/src/init/ossec-hids-alpine.init @@ -0,0 +1,57 @@ +#!/sbin/openrc-run +DIRECTORY="/var/ossec" +OSSEC_CONTROL="${DIRECTORY}/bin/ossec-control" + +depend() { + need net + use logger +} + +configtest() { + ebegin "Checking OSSEC Configuration" + checkconfig + eend $? +} + +checkconfig() { + CONFIGFILE="${CONFIGFILE:-${DIRECTORY}/etc/ossec.conf}" + if [ ! -r "${CONFIGFILE}" ]; then + eerror "Unable to read configuration file: ${CONFIGFILE}" + return 1 + fi + + # Maybe put some kind of config file syntax checking in here? XML is a little different + # so maybe not. + return $ret +} + +start() { + checkconfig || return 1 + ebegin "Starting ossec-hids" + ${OSSEC_CONTROL} start > /dev/null 2>&1 + eend $? +} + +stop() { + checkconfig || return 1 + ebegin "Stopping ossec-hids" + ${OSSEC_CONTROL} stop > /dev/null 2>&1 + eend $? +} + +restart() { + if ! service_started "${myservice}" ; then + eerror "OSSEC is not running! Please start it before trying to reload it." + else + checkconfig || return 1 + ebegin "Reloading ossec" + svc_stop ${OSSEC_CONTROL} + svc_start ${OSSEC_CONTROL} + eend $? + fi +} + +status() { + checkconfig || return 1 + ${OSSEC_CONTROL} status +}