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
|
#! /bin/sh
### BEGIN INIT INFO
# Provides: chipcardd2
# Required-Start: $syslog $remote_fs $local_fs
# Required-Stop: $syslog $remote_fs $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: daemon for smartcard access
# Description: server that libchipcard2-based program can
# connect to
### END INIT INFO
#
# NOTE: The above assumes unix sockets are used (otherwise $network and
# $named might be wanted)
#
# Start and stop chipcardd, adapted by packager from skeleton by:
#
# Written by Miquel van Smoorenburg <miquels@cistron.nl>.
# Modified for Debian GNU/Linux
# by Ian Murdock <imurdock@gnu.ai.mit.edu>.
#
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/chipcardd2
PIDFILE=/var/run/chipcard2/chipcardd2.pid
DAEMON_ARGS="--pidfile $PIDFILE --exit-on-error"
NAME=chipcardd2
DESC="libchipcard2 daemon"
test -x $DAEMON || exit 0
set -e
check_var_run() {
if [ ! -d /var/run/chipcard2 ] ; then
mkdir -p /var/run/chipcard2
chown chipcard /var/run/chipcard2
fi
}
case "$1" in
start)
echo -n "Starting $DESC: "
check_var_run
start-stop-daemon --start --quiet --pidfile $PIDFILE \
--user chipcard --chuid chipcard \
--exec $DAEMON -- $DAEMON_ARGS
echo "$NAME."
;;
stop)
echo -n "Stopping $DESC: "
start-stop-daemon --oknodo --stop --quiet --pidfile $PIDFILE \
--user chipcard --exec $DAEMON
echo "$NAME."
;;
reload)
echo "Reloading $DESC configuration files."
start-stop-daemon --stop --signal 1 --quiet --pidfile \
$PIDFILE --exec $DAEMON
;;
restart|force-reload)
echo -n "Restarting $DESC: "
start-stop-daemon --oknodo --stop --quiet --pidfile $PIDFILE \
--user chipcard --exec $DAEMON
sleep 1
check_var_run
start-stop-daemon --start --quiet --pidfile $PIDFILE \
--user chipcard --chuid chipcard --exec $DAEMON -- $DAEMON_ARGS
echo "$NAME."
;;
*)
N=$0
echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
exit 1
;;
esac
exit 0
|