Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /bin/sh
- #
- # Copyright (C) 2003 Andreas Jellinghaus
- #
- # /etc/init.d/openct
- #
- ### BEGIN INIT INFO
- # Provides: openct
- # Required-Start: syslog
- # Required-Stop: syslog
- # Default-Start: 2 3 5
- # Default-Stop:
- # Description: Start smart card readers
- ### END INIT INFO
- CTLBIN=/usr/sbin/openct-control
- #test -x $CTLBIN || exit 0
- # Shell functions sourced from /etc/rc.status:
- # rc_check check and set local and overall rc status
- # rc_status check and set local and overall rc status
- # rc_status -v ditto but be verbose in local rc status
- # rc_status -v -r ditto and clear the local rc status
- # rc_failed set local and overall rc status to failed
- # rc_reset clear local rc status (overall remains)
- # rc_exit exit appropriate to overall rc status
- . /etc/rc.status
- rc_reset
- # Return values acc. to LSB for all commands but status:
- # 0 - success
- # 1 - misc error
- # 2 - invalid or excess args
- # 3 - unimplemented feature (e.g. reload)
- # 4 - insufficient privilege
- # 5 - program not installed
- # 6 - program not configured
- #
- # Note that starting an already running service, stopping
- # or restarting a not-running service as well as the restart
- # with force-reload (in case signalling is not supported) are
- # considered a success.
- case "$1" in
- start)
- echo -n "Starting smart card terminals"
- $CTLBIN init
- rc_status -v
- ;;
- stop)
- echo -n "Stopping smart card terminals"
- $CTLBIN shutdown
- rc_status -v
- ;;
- reload)
- ;;
- restart|force-reload)
- $0 stop
- $0 start
- rc_status
- ;;
- try-restart)
- $0 status >/dev/null && $0 restart
- rc_status
- ;;
- status)
- echo -n "Checking for smart card terminals"
- if openct-tool list >/dev/null 2>&1; then
- rc_failed 0
- else
- rc_failed 3
- fi
- rc_status -v
- ;;
- *)
- echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}" >&2
- exit 1
- ;;
- esac
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment