home *** CD-ROM | disk | FTP | other *** search
/ chilidog.highland.cc.ks.us / chilidog.highland.cc.ks.us.zip / chilidog.highland.cc.ks.us / backup / bradford.20101108.etc.tar.gz / bradford.20101108.etc.tar / etc / init.d / openct < prev    next >
Text File  |  2006-05-02  |  2KB  |  84 lines

  1. #! /bin/sh
  2. #
  3. # Copyright (C) 2003 Andreas Jellinghaus
  4. #
  5. # /etc/init.d/openct
  6. #
  7. ### BEGIN INIT INFO
  8. # Provides:       openct
  9. # Required-Start: syslog
  10. # Required-Stop:  syslog
  11. # Default-Start:  2 3 5
  12. # Default-Stop:
  13. # Description:    Start smart card readers
  14. ### END INIT INFO
  15.  
  16. CTLBIN=/usr/sbin/openct-control
  17.  
  18. #test -x $CTLBIN || exit 0
  19.  
  20. # Shell functions sourced from /etc/rc.status:
  21. #      rc_check         check and set local and overall rc status
  22. #      rc_status        check and set local and overall rc status
  23. #      rc_status -v     ditto but be verbose in local rc status
  24. #      rc_status -v -r  ditto and clear the local rc status
  25. #      rc_failed        set local and overall rc status to failed
  26. #      rc_reset         clear local rc status (overall remains)
  27. #      rc_exit          exit appropriate to overall rc status
  28. . /etc/rc.status
  29.  
  30. rc_reset
  31.  
  32. # Return values acc. to LSB for all commands but status:
  33. # 0 - success
  34. # 1 - misc error
  35. # 2 - invalid or excess args
  36. # 3 - unimplemented feature (e.g. reload)
  37. # 4 - insufficient privilege
  38. # 5 - program not installed
  39. # 6 - program not configured
  40. #
  41. # Note that starting an already running service, stopping
  42. # or restarting a not-running service as well as the restart
  43. # with force-reload (in case signalling is not supported) are
  44. # considered a success.
  45.  
  46. case "$1" in
  47.   start)
  48.     echo -n "Starting smart card terminals"
  49.     $CTLBIN init
  50.     rc_status -v
  51.     ;;
  52.   stop)
  53.     echo -n "Stopping smart card terminals"
  54.     $CTLBIN shutdown
  55.     rc_status -v
  56.     ;;
  57.   reload)
  58.       ;;
  59.   restart|force-reload)
  60.     $0 stop
  61.     $0 start
  62.     rc_status
  63.     ;;
  64.   try-restart)
  65.       $0 status >/dev/null &&  $0 restart
  66.     rc_status
  67.     ;;
  68.   status)
  69.       echo -n "Checking for smart card terminals"
  70.     if openct-tool list >/dev/null 2>&1; then
  71.         rc_failed 0
  72.     else
  73.         rc_failed 3
  74.     fi
  75.     rc_status -v
  76.     ;;
  77.   *)
  78.     echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}" >&2
  79.     exit 1
  80.     ;;
  81. esac
  82.  
  83. exit 0
  84.