特殊:Badtitle/NS100:RcLocalHowto:修订间差异

来自Ubuntu中文
跳到导航跳到搜索
Oneleaf留言 | 贡献
新页面: {{From|https://help.ubuntu.com/community/RcLocalHowto}} {{Languages|UbuntuHelp:RcLocalHowto}} == An rc.local equivalent for Debian/Ubuntu == In many distributions you can add commands ...
 
Wikibot留言 | 贡献
无编辑摘要
 
(未显示同一用户的4个中间版本)
第1行: 第1行:
{{From|https://help.ubuntu.com/community/RcLocalHowto}}
{{From|https://help.ubuntu.com/community/RcLocalHowto}}
{{Languages|UbuntuHelp:RcLocalHowto}}
{{Languages|UbuntuHelp:RcLocalHowto}}
 
== An rc.local equivalent in Ubuntu ==
== An rc.local equivalent for Debian/Ubuntu ==
* See /etc/rc.local
 
== Another implementation for Debian/Ubuntu ==
 
In many distributions you can add commands to run certain programs at the end of the boot process after all system services have been started. For this purpose various distribution uses various methods. For example in Redhat based distributions we can add our own scripts or  programs into the /etc/rc.d/rc.local file, however there is no such file in a Debian based system. Here is the way to accomplish the same thing the debian way:
In many distributions you can add commands to run certain programs at the end of the boot process after all system services have been started. For this purpose various distribution uses various methods. For example in Redhat based distributions we can add our own scripts or  programs into the /etc/rc.d/rc.local file, however there is no such file in a Debian based system. Here is the way to accomplish the same thing the debian way:
=== Creatting /etc/init.d/local ===
=== Creatting /etc/init.d/local ===
<pre><nowiki>
<pre><nowiki>
sudo vi /etc/init.d/local
sudo vi /etc/init.d/local
</nowiki></pre>
</nowiki></pre>
This file is a shell script and it should start with:
This file is a shell script and it should start with:
<pre><nowiki>
<pre><nowiki>#! wiki
#! /bin/sh
#!/bin/sh
</nowiki></pre>
</nowiki></pre>
=== Making the file executable ===
=== Making the file executable ===
Make this file executable with:
Make this file executable with:
<pre><nowiki>
<pre><nowiki>
sudo chmod +x /etc/init.d/local
sudo chmod +x /etc/init.d/local
</nowiki></pre>
</nowiki></pre>
=== link the new local file with Init ===
=== link the new local file with Init ===
We are going to use this script a System V init script using:
We are going to use this script a System V init script using:
<pre><nowiki>
<pre><nowiki>
第31行: 第24行:
</nowiki></pre>
</nowiki></pre>
=== An Example ===
=== An Example ===
Now you can call your scripts or pograms using this file. For example, to mount a NFS directry at boot time add the following line to /etc/init.d/rc.local
Now you can call your scripts or pograms using this file. For example, to mount a NFS directry at boot time add the following line to /etc/init.d/rc.local
<pre><nowiki>
<pre><nowiki>
mount server.fossedu.org:/data /data
mount server.fossedu.org:/data /data
</nowiki></pre>
</nowiki></pre>
Thanks to: http://plope.com/Members/chrism/debian_rc_local_equiv
Thanks to: http://plope.com/Members/chrism/debian_rc_local_equiv
Howto created by: ChinthakaDeshapriya.
Howto created by: ChinthakaDeshapriya.
----
----
[[category:CategoryDocumentation]]


[[category:UbuntuHelp]]
[[category:UbuntuHelp]]

2010年5月20日 (四) 00:01的最新版本

{{#ifexist: :RcLocalHowto/zh | | {{#ifexist: RcLocalHowto/zh | | {{#ifeq: {{#titleparts:RcLocalHowto|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:RcLocalHowto|1|-1|}} | zh | | }}

An rc.local equivalent in Ubuntu

  • See /etc/rc.local

Another implementation for Debian/Ubuntu

In many distributions you can add commands to run certain programs at the end of the boot process after all system services have been started. For this purpose various distribution uses various methods. For example in Redhat based distributions we can add our own scripts or programs into the /etc/rc.d/rc.local file, however there is no such file in a Debian based system. Here is the way to accomplish the same thing the debian way:

Creatting /etc/init.d/local

sudo vi /etc/init.d/local

This file is a shell script and it should start with:

#! wiki
#!/bin/sh

Making the file executable

Make this file executable with:

 sudo chmod +x /etc/init.d/local

link the new local file with Init

We are going to use this script a System V init script using:

sudo update-rc.d local defaults 80

An Example

Now you can call your scripts or pograms using this file. For example, to mount a NFS directry at boot time add the following line to /etc/init.d/rc.local

mount server.fossedu.org:/data /data

Thanks to: http://plope.com/Members/chrism/debian_rc_local_equiv Howto created by: ChinthakaDeshapriya.