template.xml 1.1 KB

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