I'm somewhat new to Linux and OpenXCAP and I'm trying to make an init.d script for OpenXCAP on CentOS 6.
My script can start and stop OpenXCAP service, but it returns this error for the status command (service openxcap status): openxcap dead but subsys locked
Maybe somebody can tell me if problem is in the init.d script or the openxcap service itself? Is openxcap missing some 'give-status' feature?
#!/bin/bash
#
# Startup script for OpenXCAP
#
# processname: openxcap
# pidfile: /var/run/openxcap/openxcap.pid
# chkconfig: - 85 15
# description: start, stop, restart OpenXCAP server
#
### BEGIN INIT INFO
# Provides: openxcap
# Required-Start: $local_fs $network
# Should-Start: mysqld
### END INIT INFO
# Source function library.
. /etc/rc.d/init.d/functions
APP_NAME=openxcap
APP_HOME=/usr/local/src/openxcap-2.0.1
PID_PATH=/var/run/openxcap/openxcap.pid
RETVAL=0
[ -f /etc/sysconfig/$APP_NAME ] && . /etc/sysconfig/$APP_NAME
start()
{
echo -n $"Starting $APP_NAME: "
daemon $APP_HOME/$APP_NAME $OPTIONS 2>/dev/null | tail -1
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/$APP_NAME
}
stop()
{
echo -n $"Stopping $APP_NAME: "
killproc -p $PID_PATH
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/$APP_NAME $PID_PATH
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status $APP_NAME
RETVAL=$?
;;
restart|reload)
stop
start
;;
*)
echo $"Usage: $APP_NAME {start|stop|reload|restart|status|help}"
exit 1
esac
exit $RETVAL