Project

General

Profile

Feature #189

Bare bones redhat-style init script for prelude-lml

Added by over 17 years ago. Updated almost 15 years ago.

Status:
Closed
Priority:
Low
Target version:
Start date:
Due date:
% Done:

0%

Resolution:
duplicate

Description

#!/bin/sh

#

  1. A barebones redhat-style startup script for prelude-lml

#

  1. chkconfig: 345 99 10
  1. description: Start/Stop prelude-lml as a daemon server
  1. pidfile: /var/run/prelude-lml.pid
  1. lockfile: /var/lock/subsys/prelude-lml

#

  1. Usage /etc/init.d/prelude-lml {start|stop|restart|status|condrestart}

prog=prelude-lml

exe=/usr/local/bin/prelude-lml

PIDFILE=/var/run/${prog}.pid

LOCKFILE=/var/lock/subsys/${prog}

  1. Source function library.

. /etc/rc.d/init.d/functions

  1. Source networking configuration.

. /etc/sysconfig/network

  1. Check that networking is up.

[ ${NETWORKING} = "no" ] && exit 0

  1. Minimize PATH passed on

PATH=/bin:/sbin

export PATH

start()

{

echo -ne "\rStarting ${prog} : "
if [ -f ${LOCKFILE} ] ; then
echo -ne "Lock file exists :" && echo_failure
echo
exit -1;
fi
touch ${LOCKFILE} >> /dev/null 2>&1
if [ ! -f ${LOCKFILE} ] ; then
echo -ne "Cannot create lock file :" && echo_failure
echo
exit -1;
fi
$exe --daemon --pidfile=${PIDFILE} && echo_success
echo
return $RETVAL

}

stop()

{

echo -ne "\rStopping ${prog} :"
killproc ${exe}
RETVAL=${?}
[ ${RETVAL} = 0 ] && rm -f ${LOCKFILE} ${PIDFILE}
echo
return ${RETVAL}

}

condrestart()

{

[ -e ${LOCKFILE} ] && restart || :

}

if [ ! -x ${exe} ] ; then

echo -n "No such service ${prog} : "
if [ ! -f ${exe} ] ; then
echo -n "No such executable ${exe}" && echo_failure
else
echo -n "Insufficient permissions for ${exe}" && echo_failure
fi
exit -1

fi

case "${1}" in

start)

start
;;

stop)

stop
;;

restart)

stop
start
;;

status)

status ${exe}
RETVAL=${?}
;;

condrestart)

condrestart
;;

*)

echo "Usage: /etc/init.d/${prog} {start|stop|restart|status|condrestart}"

exit -1

esac

exit ${RETVAL}

History

#1 Updated by Yoann VANDOORSELAERE over 17 years ago

  • Status changed from New to Closed
  • Resolution set to duplicate

Duplicate #190.

#2 Updated by Yoann VANDOORSELAERE almost 15 years ago

  • Project changed from PRELUDE SIEM to Prelude-LML
  • Category deleted (4)
  • Target version deleted (0.9.9)

Also available in: Atom PDF