2006-11-13 05:05:01 +01:00
|
|
|
#!/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 $remote_fs
|
|
|
|
# X-UnitedLinux-Should-Start: $syslog $time
|
|
|
|
# Required-Stop: $local_fs $remote_fs
|
|
|
|
# X-UnitedLinux-Should-Stop: $syslog $time
|
2007-01-03 11:22:36 +01:00
|
|
|
# Default-Start: 2 3 5
|
2006-11-13 05:05:01 +01:00
|
|
|
# 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
|
|
|
|
|
|
|
|
START_DAEMON_CMD=start_daemon
|
|
|
|
START_DAEMON_CMD_FLAG=-u
|
|
|
|
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/validate/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
|
2007-01-03 11:22:36 +01:00
|
|
|
|
|
|
|
# Make sure that the client keystore has been setup
|
|
|
|
/usr/share/java/CASA/authtoken/bin/client_keystore_setup.sh -s
|
2006-11-13 05:05:01 +01:00
|
|
|
|
|
|
|
# Start the daemon
|
|
|
|
echo -n "Starting casa_atvd..."
|
2006-11-18 08:10:14 +01:00
|
|
|
if [ "${JVM_VER}" = "SUN" ]; then
|
|
|
|
# We need to specify the single-threaded option :-( due to Sun's
|
|
|
|
# JVM bug (Bug 221420). This will be changed once the issue is
|
|
|
|
# resolved.
|
|
|
|
echo "Starting daemon using single threaded mode :-("
|
|
|
|
$START_DAEMON_CMD $START_DAEMON_CMD_FLAG $DAEMON_USER $DAEMON -d -s
|
|
|
|
else
|
|
|
|
$START_DAEMON_CMD $START_DAEMON_CMD_FLAG $DAEMON_USER $DAEMON -d
|
|
|
|
fi
|
|
|
|
|
2006-11-13 05:05:01 +01:00
|
|
|
RVAL=$?
|
|
|
|
$ECHO
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
StopDAEMON()
|
|
|
|
{
|
2006-12-08 06:45:03 +01:00
|
|
|
echo -n "Stopping casa_atvd..."
|
2006-11-13 05:05:01 +01:00
|
|
|
killproc $DAEMON
|
|
|
|
RVAL=$?
|
|
|
|
$ECHO
|
|
|
|
}
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
start)
|
|
|
|
StartDAEMON
|
|
|
|
;;
|
|
|
|
stop)
|
|
|
|
StopDAEMON
|
|
|
|
;;
|
|
|
|
restart|reload|force-reload)
|
|
|
|
StopDAEMON
|
|
|
|
sleep 1
|
|
|
|
StartDAEMON
|
|
|
|
;;
|
|
|
|
status)
|
2007-02-07 23:59:55 +01:00
|
|
|
echo -n "Checking for casa_atvd: "
|
|
|
|
## Check status with checkproc(8), if process is running
|
|
|
|
## checkproc will return with exit status 0.
|
|
|
|
|
|
|
|
# Status has a slightly different for the status command:
|
|
|
|
# 0 - service running
|
|
|
|
# 1 - service dead, but /var/run/ pid file exists
|
|
|
|
# 2 - service dead, but /var/lock/ lock file exists
|
|
|
|
# 3 - service not running
|
|
|
|
|
|
|
|
# NOTE: checkproc returns LSB compliant status values.
|
|
|
|
checkproc $DAEMON
|
|
|
|
RVAL=$?
|
2006-11-13 05:05:01 +01:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo -n "Usage: $0 <start|stop|restart|reload|force-reload>" > /dev/stderr
|
|
|
|
RVAL=1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
rc_failed $RVAL
|
|
|
|
rc_status -v
|
|
|
|
rc_exit
|
|
|
|
|