template.xml 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <sect1 id="ch07-template">
  2. <title>Creating the template script</title>
  3. <para>
  4. A new file <filename>/etc/init.d/template</filename> is created containing
  5. the following:
  6. </para>
  7. <para>
  8. <screen>
  9. <userinput>cat &gt; template &lt;&lt; "EOF"</userinput>
  10. #!/bin/sh
  11. # Begin /etc/init.d/
  12. #
  13. # Include the functions declared in the /etc/init.d/functions file
  14. #
  15. source /etc/init.d/functions
  16. case "$1" in
  17. start)
  18. echo -n "Starting ..."
  19. loadproc
  20. ;;
  21. stop)
  22. echo -n "Stopping ..."
  23. killproc
  24. ;;
  25. reload)
  26. echo -n "Reloading ..."
  27. reloadproc
  28. ;;
  29. restart)
  30. $0 stop
  31. /usr/bin/sleep 1
  32. $0 start
  33. ;;
  34. status)
  35. statusproc
  36. ;;
  37. *)
  38. echo "Usage: $0 {start|stop|reload|restart|status}"
  39. exit 1
  40. ;;
  41. esac
  42. # End /etc/init.d/
  43. <userinput>EOF</userinput>
  44. </screen>
  45. </para>
  46. </sect1>