rc.dictd 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #!/bin/sh
  2. # script courtesy of Sergio Vicari <sercari@esdebian.org>
  3. DICTD=/usr/sbin/dictd
  4. # DICTD_OPTIONS="-put -command_line -options -for -dictd -here"
  5. DICTD_OPTIONS=""
  6. PIDFILE=/var/run/dictd.pid
  7. start() {
  8. if [ -x $DICTD ]; then
  9. echo "dictd starting."
  10. $DICTD $DICTD_OPTIONS
  11. else
  12. echo "rc.dictd: cannot find $DICTD or it's not executable"
  13. fi
  14. }
  15. stop() {
  16. if [ -e "$PIDFILE" ]; then
  17. echo "Stopping the dictd server."
  18. pid=$(cat $PIDFILE)
  19. kill $pid 1> /dev/null 2> /dev/null
  20. # Just in case:
  21. killall dictd 1> /dev/null 2> /dev/null
  22. rm -f $PIDFILE
  23. fi
  24. }
  25. reload() {
  26. echo "Reloading dictd."
  27. if [ -e "$PIDFILE" ]; then
  28. pid=$(cat $PIDFILE)
  29. kill -HUP $pid
  30. else
  31. killall -HUP dictd
  32. fi
  33. }
  34. status() {
  35. if [ -e /var/run/dictd.pid ]; then
  36. echo "the dictd server is running."
  37. else
  38. echo "dictd server is stopped."
  39. fi
  40. }
  41. # See how we were called.
  42. case "$1" in
  43. start)
  44. start
  45. ;;
  46. stop)
  47. stop
  48. ;;
  49. restart)
  50. stop
  51. start
  52. ;;
  53. reload)
  54. reload
  55. ;;
  56. status)
  57. status
  58. ;;
  59. *)
  60. echo $"Usage: $0 {start|stop|restart|reload|status}"
  61. ;;
  62. esac