2010-05-11 20:02:05 +02:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Start/Stop/Restart the PC/SC-lite smart card daemon.
|
|
|
|
#
|
|
|
|
# pcscd should be started after pcmcia and shut down
|
|
|
|
# before it for smooth experience with PCMCIA readers.
|
|
|
|
#
|
|
|
|
|
2010-05-11 22:26:57 +02:00
|
|
|
PIDFILE=/var/run/pcscd/pcscd.pid
|
2010-05-11 20:02:05 +02:00
|
|
|
PCSCD_OPTS=""
|
|
|
|
|
|
|
|
# Start
|
|
|
|
pcscd_start() {
|
|
|
|
if [ -x /usr/sbin/pcscd ]; then
|
|
|
|
if [ -e "$PIDFILE" ]; then
|
|
|
|
echo "PC/SC-lite daemon already started!"
|
|
|
|
else
|
|
|
|
echo "Starting PC/SC-lite smart card daemon..."
|
|
|
|
/usr/sbin/update-reader.conf
|
|
|
|
/usr/sbin/pcscd $PCSCD_OPTS
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# Stop
|
|
|
|
pcscd_stop() {
|
|
|
|
echo "Stopping PC/SC-lite smart card daemon..."
|
|
|
|
if [ -e "$PIDFILE" ]; then
|
|
|
|
kill $(cat $PIDFILE)
|
2010-05-11 22:26:57 +02:00
|
|
|
rm -f $PIDFILE 1>&2 >/dev/null
|
2010-05-11 20:02:05 +02:00
|
|
|
fi
|
|
|
|
# Just in case:
|
|
|
|
killall pcscd 1>&2 >/dev/null
|
|
|
|
}
|
|
|
|
|
|
|
|
# Restart
|
|
|
|
pcscd_restart() {
|
|
|
|
pcscd_stop
|
|
|
|
sleep 3
|
|
|
|
pcscd_start
|
|
|
|
}
|
|
|
|
|
2010-05-11 22:26:57 +02:00
|
|
|
# Status
|
|
|
|
pcscd_status() {
|
|
|
|
if [ -e "$PIDFILE" ]; then
|
|
|
|
echo "pcscd is running."
|
|
|
|
else
|
|
|
|
echo "pcscd is stopped."
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2010-05-11 20:02:05 +02:00
|
|
|
case "$1" in
|
|
|
|
'start')
|
|
|
|
pcscd_start
|
|
|
|
;;
|
|
|
|
'stop')
|
|
|
|
pcscd_stop
|
|
|
|
;;
|
|
|
|
'restart')
|
|
|
|
pcscd_restart
|
|
|
|
;;
|
2010-05-11 22:26:57 +02:00
|
|
|
'status')
|
|
|
|
pcscd_status
|
|
|
|
;;
|
2010-05-11 20:02:05 +02:00
|
|
|
*)
|
2010-05-11 22:26:57 +02:00
|
|
|
echo "usage $0 start|stop|restart|status"
|
2010-05-11 20:02:05 +02:00
|
|
|
esac
|