Feature #189
Bare bones redhat-style init script for prelude-lml
Start date:
Due date:
% Done:
0%
Resolution:
duplicate
Description
#!/bin/sh
#
- A barebones redhat-style startup script for prelude-lml
#
- chkconfig: 345 99 10
- description: Start/Stop prelude-lml as a daemon server
- pidfile: /var/run/prelude-lml.pid
- lockfile: /var/lock/subsys/prelude-lml
#
- 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}
- Source function library.
. /etc/rc.d/init.d/functions
- Source networking configuration.
. /etc/sysconfig/network
- Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
- 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 16 years ago
- Status changed from New to Closed
- Resolution set to duplicate
Duplicate #190.
#2 Updated by Yoann VANDOORSELAERE about 14 years ago
- Project changed from PRELUDE SIEM to Prelude-LML
- Category deleted (
4) - Target version deleted (
0.9.9)