File: pcscd.init

package info (click to toggle)
pcsc-lite 1.0.2.beta5-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,880 kB
  • ctags: 1,165
  • sloc: sh: 9,016; ansic: 6,752; lex: 219; makefile: 175; perl: 69
file content (83 lines) | stat: -rw-r--r-- 1,685 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#! /bin/sh
#
# /etc/init.d/pcscd
# Start/Stop/Restart PCSC Lite resource manager daemon
#
# Carlos Prados Bocos <cprados@debian.org>
# modifications by Ludovic Rousseau <ludovic.rousseau@free.fr>

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/pcscd
NAME=pcscd
DESC="PCSC Lite resource manager"

test -f $DAEMON || exit 0

set -e

case "$1" in
  start)
	echo -n "Starting $DESC: "
	start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
	--exec $DAEMON
	echo "$NAME."
	;;

  stop)
	echo -n "Stopping $DESC: "
	start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/$NAME.pid \
	--exec $DAEMON
	sleep 2
	echo "$NAME."
	;;
	
  restart|force-reload)
	echo -n "Restarting $DESC: "
	start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/$NAME.pid \
	--exec $DAEMON
	sleep 2
	start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
	--exec $DAEMON
	echo "$NAME."
	;;
	
  restart-if-running)
    echo -n "Stopping $DESC if it is running: "
	if start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \
		--exec ${DAEMON} ;
	then
		echo "${NAME}."
		echo -n "Restarting $DESC: "
		sleep 2
		start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
			--exec ${DAEMON}
		echo "${NAME}."
	else
		echo "(not running)."
	fi
	;; 

  status)
	if [ -e /var/run/$NAME.pid ] ; then
		if ps -p $(cat /var/run/$NAME.pid) &> /dev/null ; then
			echo "running"
			exit 0
		else
			echo "not running and /var/run/$NAME.pid exists"
			exit 1
		fi
	else
		echo "not running"
		exit 3
	fi
	;;

  *)
	N=/etc/init.d/$NAME
	echo "Usage: $N {start|stop|restart|force-reload|restart-if-running|status}" >&2
	exit 1
	;;
esac

exit 0