<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
> <channel><title>gHacks Technology News &#124; Latest Tech News, Software And Tutorials &#187; linux boot</title> <atom:link href="http://www.ghacks.net/tag/linux-boot/feed/" rel="self" type="application/rss+xml" /><link>http://www.ghacks.net</link> <description>A technology news blog covering software, mobile phones, gadgets, security, the Internet and other relevant areas.</description> <lastBuildDate>Sat, 11 Feb 2012 17:32:23 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/> <item><title>Starting services at boot in Linux</title><link>http://www.ghacks.net/2009/11/04/starting-services-at-boot-in-linux/</link> <comments>http://www.ghacks.net/2009/11/04/starting-services-at-boot-in-linux/#comments</comments> <pubDate>Wed, 04 Nov 2009 17:25:40 +0000</pubDate> <dc:creator>Jack Wallen</dc:creator> <category><![CDATA[Advice]]></category> <category><![CDATA[Linux]]></category> <category><![CDATA[Open Source]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[boot services]]></category> <category><![CDATA[init]]></category> <category><![CDATA[linux boot]]></category> <category><![CDATA[rc.local]]></category> <category><![CDATA[runlevels]]></category> <category><![CDATA[sysV]]></category> <guid
isPermaLink="false">http://www.ghacks.net/?p=18116</guid> <description><![CDATA[There are plenty of times when you may want to add a new service to start when your Linux machine boots. Or you may want to stop a service from starting upon boot. And, like nearly every aspect of Linux, there are many ways to deal with this scenario. And different distributions handle this in [...]]]></description> <content:encoded><![CDATA[<p>There are plenty of times when you may want to add a new service to start when your Linux machine boots. Or you may want to stop a service from starting upon boot. And, like nearly every aspect of Linux, there are many ways to deal with this scenario. And different distributions handle this in different ways. So what is the best way for you to manage this task?</p><p>Because different distributions handle this task differently, we will examine how Fedora (and friends) handle the task and how Ubuntu (and friends) handle the task. As well we will also examine a neutral method that can always work in a pinch. All three methods will be command line, so stretch out those fingers and get ready to type.</p><p><span
id="more-18116"></span><strong>Fedora (and friends)</strong></p><p>The Fedora distribution uses the <em>chkconfig</em> command to update and query system run-level information for system services. The usage of this command is:</p><p><em>chkconfig OPTIONS SERVICE ON/OF</em></p><p>Where:</p><ul><li><span
style="background-color: #ffffff">OPTIONS are the various options the command offers.</span></li><li><span
style="background-color: #ffffff">SERVICE is the service you want to add at startup.</span></li><li><span
style="background-color: #ffffff">ON/OFF is either on or off &#8211; depending on if you want the s<span
style="background-color: #ffffff">ervice to start or not.</span></span></li></ul><p><span
style="background-color: #ffffff">The confusion with the <em>chkconfig </em>command generally boils down to runlevel. The typical Linux runlevels are:</span></p><ul><li><span
style="background-color: #ffffff">0 &#8211; Halt</span></li><li><span
style="background-color: #ffffff">1 &#8211; Single user mode</span></li><li><span
style="background-color: #ffffff">2 &#8211; Multi user mode</span></li><li><span
style="background-color: #ffffff">3 &#8211; Multi user mode with networking</span></li><li><span
style="background-color: #ffffff">4 &#8211; Not used</span></li><li><span
style="background-color: #ffffff">5 &#8211; X11</span></li><li><span
style="background-color: #ffffff">6 &#8211; Reboot</span></li></ul><p><span
style="background-color: #ffffff">So with <em>chkconfig </em>you can also define at which point the service starts. So let&#8217;s say you want Apache to start at boot and you want it to start for levels 3, 4, and 5. For this you would issue the command (as the root user):</span></p><p><span
style="background-color: #ffffff"><em>chkconfig &#8211;level 345 httpd on</em></span></p><p><span
style="background-color: #ffffff">Now, if you don&#8217;t want Apache to run at boot you could issue the command:</span></p><p><span
style="background-color: #ffffff"><em>chkconfig httpd off</em></span></p><p><span
style="background-color: #ffffff">If you want to know what services are running at boot you can issue the command:</span></p><p><span
style="background-color: #ffffff"><em>chkconfig &#8211;list</em></span></p><p><span
style="background-color: #ffffff">The above command will list out all services that are starting at boot time.</span></p><p><span
style="background-color: #ffffff"><strong>Ubuntu (and friends)</strong></span></p><p><span
style="background-color: #ffffff">Ubuntu (and friends) takes a totally different route to the same destination. Instead of using <em>chkconfig </em>Ubuntu uses the <em>update-rc.d</em> command. This command makes things pretty simple. The command structure is:</span></p><p><em>update-rc.d SERVICE OPTIONS</em></p><p>Where OPTIONS are available options and SERVICE is the service you want to start.</p><p>With <em>update-rc.d</em> there is an option that makes it simple: <em>defaults.</em> So to add sshd to the start up process, you would issue the command:</p><p><em>sudo update-rc.d sshd defaults</em></p><p>To remove the same service from start up you would issue the following command:</p><p><em>sudo update-rc.d sshd remove</em></p><p>Now let&#8217;s take a look at a fail safe, nearly-universal method</p><p><strong>rc.local</strong></p><p>There is another means of getting a service to start. I recommend using either of the two above before you try this means. The <strong>rc.local</strong> file is a file that is executed at the end of the multiuser runlevel. By default, this script does nothing, but you can add to it so that it does.</p><p>Say you want Apache to start at boot up, and you want to do so from <strong>rc.local</strong>. You can do this by adding one of the following lines at the end of your <strong>/etc/rc.local</strong> file.</p><p>Fedora:</p><p><em>/etc/init.d/rc.d/httpd star</em>t</p><p>Ubuntu:</p><p><em>/etc/init.d/apache2 start</em></p><p>Save that file and you should be good to go. If you change your mind and do not want that service to start at boot, just remove the line you added.</p><p><strong>Final thoughts</strong></p><p>The above should allow you get that service that needs to start at boot working correctly. Make sure, however, you use the distribution-prescribed method before you use the <strong>rc.local</strong> method.</p> ]]></content:encoded> <wfw:commentRss>http://www.ghacks.net/2009/11/04/starting-services-at-boot-in-linux/feed/</wfw:commentRss> <slash:comments>6</slash:comments> </item> </channel> </rss>
