/vp_plugins/sptsd/init.d/sptsd

http://cupsfilter.googlecode.com/ · Shell · 101 lines · 49 code · 9 blank · 43 comment · 3 complexity · 4a29684b1bc978f44c20f7f81d2d1f1a MD5 · raw file

  1. #! /bin/sh
  2. # Copyright (c) 1996-2002 SuSE GmbH Nuernberg, Germany. All rights reserved.
  3. #
  4. # Author: Michail Tumashenko <mtumashenko@techoserv.ru>, Vladimir Skomorokhov <sva@technoserv.ru>
  5. #
  6. # /etc/init.d/sptsd
  7. #
  8. ### BEGIN INIT INFO
  9. # Provides: technoserv
  10. # Required-Start: $network
  11. # Required-Stop:
  12. # Default-Start: 3 5
  13. # Default-Stop: 0 1 6
  14. # Description: start sptsd
  15. ### END INIT INFO
  16. SPTSD=/sbin/sptsd
  17. #SPTSD=/usr/local/src/daemon-2010-03-12/sptsd
  18. SPTSDIR=/usr/local/src/daemon-2010-03-12/
  19. SPTSDCONF=$SPTSDIR/sptsd.conf
  20. test -x $SPTSD || exit 5
  21. # Shell functions sourced from /etc/rc.status:
  22. # rc_check check and set local and overall rc status
  23. # rc_status check and set local and overall rc status
  24. # rc_status -v ditto but be verbose in local rc status
  25. # rc_status -v -r ditto and clear the local rc status
  26. # rc_failed set local and overall rc status to failed
  27. # rc_failed <num> set local and overall rc status to <num><num>
  28. # rc_reset clear local rc status (overall remains)
  29. # rc_exit exit appropriate to overall rc status
  30. . /etc/rc.status
  31. # First reset status of this service
  32. rc_reset
  33. # Return values acc. to LSB for all commands but status:
  34. # 0 - success
  35. # 1 - generic or unspecified error
  36. # 2 - invalid or excess argument(s)
  37. # 3 - unimplemented feature (e.g. "reload")
  38. # 4 - insufficient privilege
  39. # 5 - program is not installed
  40. # 6 - program is not configured
  41. # 7 - program is not running
  42. #
  43. # Note that starting an already running service, stopping
  44. # or restarting a not-running service as well as the restart
  45. # with force-reload (in case signalling is not supported) are
  46. # considered a success.
  47. # check whether to enable agentx support and get list of installed
  48. # agents
  49. case "$1" in
  50. start)
  51. echo -n "Starting sptsd"
  52. startproc $SPTSD
  53. # startproc $SPTSD -c $SPTSDCONF
  54. rc_status -v
  55. rc_reset
  56. ;;
  57. stop)
  58. echo -n "Shutting down sptsd:"
  59. killproc -TERM $SPTSD
  60. rc_status -v ; rc_reset
  61. ;;
  62. try-restart)
  63. $0 status >/dev/null && $0 restart
  64. rc_status
  65. ;;
  66. restart)
  67. $0 stop
  68. $0 start
  69. rc_status
  70. ;;
  71. force-reload)
  72. echo -n "Reload service sptsd:"
  73. killproc -HUP $SPTSD
  74. rc_status -v
  75. ;;
  76. reload)
  77. echo -n "Reload service sptsd:"
  78. killproc -HUP $SPTSD
  79. rc_status -v
  80. ;;
  81. status)
  82. echo -n "Checking for service sptsd:"
  83. checkproc $SPTSD
  84. rc_status -v
  85. rc_reset
  86. ;;
  87. *)
  88. echo "Usage: $0 {start|stop|try-restart|restart|force-reload|reload|status}"
  89. exit 1
  90. ;;
  91. esac
  92. rc_exit