#!/bin/sh # # pcscd This shell script takes care of starting and stopping # pcscd, the PC/SC (Smart Card) daemon. # # pcsc-lite is a middleware to access a smart card using SCard API (PC/SC). [ ! -x /usr/sbin/pcscd ] && exit 99 [ ! -f /etc/sysconfig/pcscd ] && exit 99 # Source the configuration file: source /etc/sysconfig/pcscd pcscd_start() { if [ -e "$PIDFILE" ]; then echo -n "PC/SC-lite daemon (pcscd) already started!" else echo -n "Starting pcscd: " /usr/sbin/pcscd $PCSCD_OPTS fi echo } pcscd_stop() { echo -n "Shutting down pcscd: " pkill pcscd rm -f $PIDFILE 1>/dev/null 2>/dev/null echo } pcscd_restart() { pcscd_stop sleep 2 pcscd_start } pcscd_status() { pids=$(pgrep pcscd) if test "$pids" ; then for p in $pids ; do echo "pcscd (pid $p) is running." ps up $p done else echo "pcscd is stopped." fi } case "$1" in start) pcscd_start ;; stop) pcscd_stop ;; restart) pcscd_restart ;; status) pcscd_status ;; *) echo "Usage: $0 start|stop|restart|status" exit 1 ;; esac exit 0