template.xml 1.1 KB

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