libopenct/libopenct.initscript

74 lines
1.8 KiB
Bash

#!/bin/sh
#
# openct This shell script takes care of starting and stopping OpenCT.
#
# chkconfig: 2345 24 89
# description: OpenCT is a middleware framework for smart card terminals.
#
# processname: ifdhandler
# config: /etc/openct.conf
### BEGIN INIT INFO
# Provides: openct
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Should-Start: $syslog $network
# Should-Stop: $syslog $network
# Short-Description: Middleware framework for smart card terminals
### END INIT INFO
. /etc/sysconfig/rc
# Source function library.
[ -r "$rc_functions" ] && . $rc_functions
NAME=openct
DAEMON=/usr/sbin/openct-control
PROC=ifdhandler
OPTIONS=
[ -e /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME
case "$1" in
start)
RETVAL=0
if ! status $PROC >/dev/null 2>&1 ; then
action $"Initializing OpenCT smart card terminals: " \
$DAEMON $OPENCT_OPTIONS init
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$NAME
fi
;;
stop)
if status $PROC >/dev/null 2>&1 ; then
action $"Stopping OpenCT smart card terminals: " \
$DAEMON $OPENCT_OPTIONS shutdown
fi
RETVAL=$?
if [ $RETVAL -eq 0 ] ; then
rm -f /var/run/openct/status
rm -f /var/lock/subsys/$NAME
fi
;;
restart|reload|force-reload)
$0 stop
sleep 1
$0 start
;;
status)
statusproc $PROC
RETVAL=$?
if [ -e /var/run/openct/status ] ; then
$DAEMON $OPENCT_OPTIONS status
[ -e /var/run/openct/status ] && \
echo $"Waiting for reader attach/detach events..."
fi
;;
try-restart|condrestart)
[ -e /var/lock/subsys/$NAME ] && $0 restart || :
;;
*)
echo $"Usage: ""$0 {start|stop|status|restart|try-restart|reload|force-reload}"
exit 1
;;
esac