< Day Day Up > |
7.9.1 ProblemYou need to start, stop, or restart a service, but you don't want to make it permanent. Maybe your network connection has wedged or your web server has died. Or you changed the configuration file for a service, and need to restart it to activate the changes. Or you are testing a new service, so you want to start it up only when you're testing it. 7.9.2 SolutionRun the program's startup script in /init.d. Find the appropriate script in init.d, then read the script to see the available options. For example, restarting networking is a common need. Take a look in /etc/init.d/networking: echo "Usage: /etc/init.d/networking {start|stop|restart|force-reload}" There's a line like this in every init script. Another way to get this information is to run the script with no arguments: # /etc/init.d/networking Usage: /etc/init.d/networking {start|stop|restart|force-reload} So, to stop networking, use the command: # /etc/init.d/networking stop 7.9.3 DiscussionFor any program that has a startup script, it is preferable to use the script, rather than executing the program's binary, because the script includes include error and file checking, and any needed conditional tests. |
< Day Day Up > |