rc.common 840 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #!/bin/sh
  2. . /etc/functions.sh
  3. start() {
  4. return 0
  5. }
  6. stop() {
  7. return 0
  8. }
  9. reload() {
  10. return 1
  11. }
  12. restart() {
  13. stop
  14. start
  15. }
  16. boot() {
  17. start
  18. }
  19. shutdown() {
  20. return 0
  21. }
  22. disable() {
  23. rm -f /etc/rc.d/${initscript##*/}
  24. }
  25. enable() {
  26. disable
  27. ln -s /etc/init.d/${initscript##*/} /etc/rc.d/${initscript##*/}
  28. }
  29. depends() {
  30. return 0
  31. }
  32. help() {
  33. cat <<EOF
  34. Syntax: $initscript [command]
  35. Available commands:
  36. start Start the service
  37. stop Stop the service
  38. restart Restart the service
  39. reload Reload configuration files (or restart if that fails)
  40. $EXTRA_HELP
  41. EOF
  42. }
  43. initscript="$1"
  44. action="$2"
  45. . "$initscript"
  46. cmds=
  47. for cmd in $EXTRA_COMMANDS; do
  48. cmds="$cmd) $cmd;;"
  49. done
  50. eval "case \"\$action\" in
  51. start) start;;
  52. stop) stop;;
  53. reload) reload || restart;;
  54. restart) restart;;
  55. boot) boot;;
  56. shutdown) shutdown;;
  57. $cmds
  58. *) help;;
  59. esac"