]> git.pld-linux.org Git - packages/pcsc-lite.git/blame - pcsc-lite-pcscd.init
up to 1.9.1
[packages/pcsc-lite.git] / pcsc-lite-pcscd.init
CommitLineData
f588025c
JB
1#!/bin/sh
2#
3# pcscd PC/SC Smartcard daemon
4#
ab856a2b 5# chkconfig: 2345 12 88
f588025c 6#
34b152c0
JB
7# description: The PC/SC smart card daemon is a resource manager for the \
8# PC/SC lite and Musclecard frameworks. It coordinates \
9# communications with smart card readers, smart cards, and \
10# cryptographic tokens that are connected to the system.
11#
12# processname: pcscd
8cc35d7b 13# config: /etc/reader.conf.d
f588025c 14#
58e06016
ER
15# Note! pcscd should be started after pcmcia, and shut down before it
16# for smooth experience with PCMCIA readers.
17#
f588025c
JB
18# $Id$
19
f588025c
JB
20# Source function library
21. /etc/rc.d/init.d/functions
22
34b152c0
JB
23umask 077
24
f588025c 25# Set defaults
43a6cfd6
ER
26LOGLEVEL=""
27PCSCD_OPTIONS=""
f588025c
JB
28
29# Get service config - may override defaults
30[ -f /etc/sysconfig/pcscd ] && . /etc/sysconfig/pcscd
31
395a40ac
ER
32pidfile=/var/run/pcscd/pcscd.pid
33
cdf5d3ee 34start() {
404fa0cc 35 if [ -f /var/lock/subsys/pcscd ]; then
9140bb49 36 msg_already_running "PC/SC smart card daemon"
404fa0cc
ER
37 return
38 fi
39
43a6cfd6
ER
40 local logopt
41 case "$LOGLEVEL" in
42 debug|info|error|critical)
43 logopt=--$LOGLEVEL
44 ;;
45 esac
404fa0cc 46
9140bb49 47 msg_starting "PC/SC smart card daemon"
43a6cfd6 48 daemon /usr/sbin/pcscd $logopt $PCSCD_OPTIONS
404fa0cc
ER
49 RETVAL=$?
50 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/pcscd
cdf5d3ee
JB
51}
52
53stop() {
404fa0cc 54 if [ ! -f /var/lock/subsys/pcscd ]; then
9140bb49 55 msg_not_running "PC/SC smart card daemon"
404fa0cc 56 return
2638beea 57 fi
404fa0cc 58
9140bb49 59 msg_stopping "PC/SC smart card daemon"
395a40ac 60 killproc --pidfile $pidfile pcscd
404fa0cc 61 rm -f /var/lock/subsys/pcscd
cdf5d3ee
JB
62}
63
64condrestart() {
404fa0cc 65 if [ ! -f /var/lock/subsys/pcscd ]; then
9140bb49 66 msg_not_running "PC/SC smart card daemon"
cdf5d3ee 67 RETVAL=$1
404fa0cc 68 return
cdf5d3ee 69 fi
404fa0cc
ER
70
71 stop
72 start
cdf5d3ee
JB
73}
74
75RETVAL=0
76# See how we were called.
77case "$1" in
78 start)
79 start
ab856a2b 80 ;;
cdf5d3ee
JB
81 stop)
82 stop
83 ;;
84 restart)
85 stop
86 start
87 ;;
88 try-restart)
89 condrestart 0
90 ;;
91 force-reload)
f588025c 92 # pcscd doesn't support reloading on HUP
cdf5d3ee 93 condrestart 7
ab856a2b 94 ;;
f588025c 95 status)
395a40ac 96 status --pidfile $pidfile pcscd
404fa0cc 97 RETVAL=$?
ab856a2b 98 ;;
f588025c 99 *)
cdf5d3ee 100 msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
bd7842e0 101 exit 3
f588025c
JB
102esac
103
104exit $RETVAL
This page took 0.218452 seconds and 4 git commands to generate.