template.xml 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. <literallayout>
  8. <userinput>cat &gt; template &lt;&lt; "EOF"</userinput>
  9. #!/bin/sh
  10. # Begin /etc/init.d/
  11. #
  12. # Include the functions declared in the /etc/init.d/functions file
  13. #
  14. source /etc/init.d/functions
  15. case "$1" in
  16. start)
  17. echo -n "Starting ..."
  18. loadproc
  19. ;;
  20. stop)
  21. echo -n "Stopping ..."
  22. killproc
  23. ;;
  24. reload)
  25. echo -n "Reloading ..."
  26. reloadproc
  27. ;;
  28. restart)
  29. $0 stop
  30. /usr/bin/sleep 1
  31. $0 start
  32. ;;
  33. status)
  34. statusproc
  35. ;;
  36. *)
  37. echo "Usage: $0 {start|stop|reload|restart|status}"
  38. exit 1
  39. ;;
  40. esac
  41. # End /etc/init.d/
  42. <userinput>EOF</userinput>
  43. </literallayout>
  44. </sect1>