Added rc script for the Validate AuthToken service.

This commit is contained in:
Juan Carlos Luciani
2006-09-14 23:42:57 +00:00
parent 5bec27ee66
commit ad42e4cc2e
6 changed files with 263 additions and 10 deletions

View File

@@ -0,0 +1,129 @@
#!/bin/sh
#
# Startup script for the Casa Authtoken Validate Daemon (casa_atvd)
#
# /etc/init.d/casa_atvd
#
# description: casa_atvd validates CASA
# authentication tokens on behalf of native (non-java)
# services.
#
# processname: casa_atvd
# pidfile: None
# config utility: None
### BEGIN INIT INFO
# Provides: casa_atvd
# Required-Start: $local_fs
# Required-Stop: $local_fs $network
# Default-Start: 1 2 3 5
# Default-Stop:
# Short-Description: Casa Authtoken Validate Daemon
# Description: Start Casa Authtoken Validate Daemon
### END INIT INFO
. /etc/rc.status
# Shell functions sourced from /etc/rc.status:
# rc_check check and set local and overall rc status
# rc_status check and set local and overall rc status
# rc_status -v ditto but be verbose in local rc status
# rc_status -v -r ditto and clear the local rc status
# rc_failed set local and overall rc status to failed
# rc_reset clear local rc status (overall remains)
# rc_exit exit appropriate to overall rc status
# First reset status of this service
rc_reset
MyStatus()
{
ps ax | grep "$DAEMON" | grep -v grep 2>&1 > /dev/null
if [ "x$?" = "x0" ]; then
RVAL=0
else
RVAL=3
fi
}
START_DAEMON_CMD=start_daemon
START_DAEMON_CMD_FLAG=-u
STATUS=MyStatus
LOG_SUCCESS=log_success_msg
LOG_FAILURE=log_failure_msg
LOG_WARNING=log_warning_msg
ECHO=
DAEMON=/usr/bin/casa_atvd
DAEMON_USER=casaatvd
StartDAEMON()
{
# Source the environments file for our daemon
. /etc/CASA/authtoken.d/validate.d/envvars
# Update the limit parameters
#
# Do not allow for unlimited core dumps if the daemon is automatically
# re-starting crashed processes.
if [ $DAEMON_NO_AUTORESTART_AFTER_CRASH ]; then
if [ $DAEMON_NO_AUTORESTART_AFTER_CRASH -ne 0 ]; then
# Feature disabled, allow core dumping.
ulimit -c unlimited
else
# Check if core dumping is allowed with the feature enabled
if [ $DAEMON_COREDUMPS_WANTED ]; then
ulimit -c unlimited
fi
fi
else
# Check if core dumping is allowed with the feature enabled
if [ $DAEMON_COREDUMPS_WANTED ]; then
ulimit -c unlimited
fi
fi
ulimit -f unlimited
# Start the daemon
echo -n "Starting casa_atvd..."
$START_DAEMON_CMD $START_DAEMON_CMD_FLAG $DAEMON_USER $DAEMON -d
RVAL=$?
$ECHO
}
StopDAEMON()
{
echo -n "Stopping casa_atvd..."
killproc $DAEMON
RVAL=$?
$ECHO
}
case "$1" in
start)
StartDAEMON
;;
stop)
StopDAEMON
;;
restart|reload|force-reload)
StopDAEMON
sleep 1
StartDAEMON
;;
status)
$STATUS
;;
*)
echo -n "Usage: $0 <start|stop|restart|reload|force-reload>" > /dev/stderr
RVAL=1
;;
esac
rc_failed $RVAL
rc_status -v
rc_exit

View File

@@ -64,7 +64,7 @@ LDFLAGS = -L$(LIBDIR)/$(TARGET_CFG) -L$(JAVA_LIBDIR) -L$(JAVA_LIBDIR)/classic
OBJDIR = ./$(TARGET_CFG)/$(LIB)
OBJS = $(addprefix $(OBJDIR)/, $(CFILES:%.c=%.o)) $(addprefix $(OBJDIR)/, $(CPPFILES:%.cpp=%.o))
EXTRA_DIST = $(CFILES) $(CPPFILES) *.h
EXTRA_DIST = $(CFILES) $(CPPFILES) *.h CasaAuthtokenValidateD
CUR_DIR := $(shell pwd)

View File

@@ -56,8 +56,11 @@ CSFILES_CSC :=
INCLUDES = -I. -I.. -I$(CASAINCLUDE) -I../../../include
RESOURCES =
DEFINES = -fno-strict-aliasing
if LIB64
DEFINES += -D_LIB64
endif
CFLAGS += $(INCLUDES) $(DEFINES)
LIBS = -lpthread -ldl -lexpat
LIBS = -lpthread -ldl
LDFLAGS = -Bsymbolic -shared -Wl,-soname=$(MODULE_NAME).$(MODULE_EXT) -L$(ROOT)/lib/$(TARGET_CFG)
OBJDIR = ./$(TARGET_CFG)/$(LIB)

View File

@@ -48,8 +48,12 @@ pthread_mutex_t g_hModuleMutex = PTHREAD_MUTEX_INITIALIZER;
//
// Ipc client library path
//
//
#ifdef _LIB64
char IpcClientLibraryPath[] = "/usr/lib64/libcasa_c_ipc.so";
#else
char IpcClientLibraryPath[] = "/usr/lib/libcasa_c_ipc.so";
#endif
//++=======================================================================