特殊:Badtitle/NS100:RcLocalHowto:修订间差异
小无编辑摘要 |
小无编辑摘要 |
||
第8行: | 第8行: | ||
</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 === |
2008年10月19日 (日) 17:02的版本
文章出处: |
{{#if: | {{{2}}} | https://help.ubuntu.com/community/RcLocalHowto }} |
点击翻译: |
English {{#ifexist: {{#if: UbuntuHelp:RcLocalHowto | UbuntuHelp:RcLocalHowto | {{#if: | :}}RcLocalHowto}}/af | • {{#if: UbuntuHelp:RcLocalHowto|Afrikaans| [[::RcLocalHowto/af|Afrikaans]]}}|}} {{#ifexist: {{#if: UbuntuHelp:RcLocalHowto | UbuntuHelp:RcLocalHowto | {{#if: | :}}RcLocalHowto}}/ar | • {{#if: UbuntuHelp:RcLocalHowto|العربية| [[::RcLocalHowto/ar|العربية]]}}|}} {{#ifexist: {{#if: UbuntuHelp:RcLocalHowto | UbuntuHelp:RcLocalHowto | {{#if: | :}}RcLocalHowto}}/az | • {{#if: UbuntuHelp:RcLocalHowto|azərbaycanca| [[::RcLocalHowto/az|azərbaycanca]]}}|}} {{#ifexist: {{#if: UbuntuHelp:RcLocalHowto | UbuntuHelp:RcLocalHowto | {{#if: | :}}RcLocalHowto}}/bcc | • {{#if: UbuntuHelp:RcLocalHowto|جهلسری بلوچی| [[::RcLocalHowto/bcc|جهلسری بلوچی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:RcLocalHowto | UbuntuHelp:RcLocalHowto | {{#if: | :}}RcLocalHowto}}/bg | • {{#if: UbuntuHelp:RcLocalHowto|български| [[::RcLocalHowto/bg|български]]}}|}} {{#ifexist: {{#if: UbuntuHelp:RcLocalHowto | UbuntuHelp:RcLocalHowto | {{#if: | :}}RcLocalHowto}}/br | • {{#if: UbuntuHelp:RcLocalHowto|brezhoneg| [[::RcLocalHowto/br|brezhoneg]]}}|}} {{#ifexist: {{#if: UbuntuHelp:RcLocalHowto | UbuntuHelp:RcLocalHowto | {{#if: | :}}RcLocalHowto}}/ca | • {{#if: UbuntuHelp:RcLocalHowto|català| [[::RcLocalHowto/ca|català]]}}|}} {{#ifexist: {{#if: UbuntuHelp:RcLocalHowto | UbuntuHelp:RcLocalHowto | {{#if: | :}}RcLocalHowto}}/cs | • {{#if: UbuntuHelp:RcLocalHowto|čeština| [[::RcLocalHowto/cs|čeština]]}}|}} {{#ifexist: {{#if: UbuntuHelp:RcLocalHowto | UbuntuHelp:RcLocalHowto | {{#if: | :}}RcLocalHowto}}/de | • {{#if: UbuntuHelp:RcLocalHowto|Deutsch| [[::RcLocalHowto/de|Deutsch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:RcLocalHowto | UbuntuHelp:RcLocalHowto | {{#if: | :}}RcLocalHowto}}/el | • {{#if: UbuntuHelp:RcLocalHowto|Ελληνικά| [[::RcLocalHowto/el|Ελληνικά]]}}|}} {{#ifexist: {{#if: UbuntuHelp:RcLocalHowto | UbuntuHelp:RcLocalHowto | {{#if: | :}}RcLocalHowto}}/es | • {{#if: UbuntuHelp:RcLocalHowto|español| [[::RcLocalHowto/es|español]]}}|}} {{#ifexist: {{#if: UbuntuHelp:RcLocalHowto | UbuntuHelp:RcLocalHowto | {{#if: | :}}RcLocalHowto}}/fa | • {{#if: UbuntuHelp:RcLocalHowto|فارسی| [[::RcLocalHowto/fa|فارسی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:RcLocalHowto | UbuntuHelp:RcLocalHowto | {{#if: | :}}RcLocalHowto}}/fi | • {{#if: UbuntuHelp:RcLocalHowto|suomi| [[::RcLocalHowto/fi|suomi]]}}|}} {{#ifexist: {{#if: UbuntuHelp:RcLocalHowto | UbuntuHelp:RcLocalHowto | {{#if: | :}}RcLocalHowto}}/fr | • {{#if: UbuntuHelp:RcLocalHowto|français| [[::RcLocalHowto/fr|français]]}}|}} {{#ifexist: {{#if: UbuntuHelp:RcLocalHowto | UbuntuHelp:RcLocalHowto | {{#if: | :}}RcLocalHowto}}/gu | • {{#if: UbuntuHelp:RcLocalHowto|ગુજરાતી| [[::RcLocalHowto/gu|ગુજરાતી]]}}|}} {{#ifexist: {{#if: UbuntuHelp:RcLocalHowto | UbuntuHelp:RcLocalHowto | {{#if: | :}}RcLocalHowto}}/he | • {{#if: UbuntuHelp:RcLocalHowto|עברית| [[::RcLocalHowto/he|עברית]]}}|}} {{#ifexist: {{#if: UbuntuHelp:RcLocalHowto | UbuntuHelp:RcLocalHowto | {{#if: | :}}RcLocalHowto}}/hu | • {{#if: UbuntuHelp:RcLocalHowto|magyar| [[::RcLocalHowto/hu|magyar]]}}|}} {{#ifexist: {{#if: UbuntuHelp:RcLocalHowto | UbuntuHelp:RcLocalHowto | {{#if: | :}}RcLocalHowto}}/id | • {{#if: UbuntuHelp:RcLocalHowto|Bahasa Indonesia| [[::RcLocalHowto/id|Bahasa Indonesia]]}}|}} {{#ifexist: {{#if: UbuntuHelp:RcLocalHowto | UbuntuHelp:RcLocalHowto | {{#if: | :}}RcLocalHowto}}/it | • {{#if: UbuntuHelp:RcLocalHowto|italiano| [[::RcLocalHowto/it|italiano]]}}|}} {{#ifexist: {{#if: UbuntuHelp:RcLocalHowto | UbuntuHelp:RcLocalHowto | {{#if: | :}}RcLocalHowto}}/ja | • {{#if: UbuntuHelp:RcLocalHowto|日本語| [[::RcLocalHowto/ja|日本語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:RcLocalHowto | UbuntuHelp:RcLocalHowto | {{#if: | :}}RcLocalHowto}}/ko | • {{#if: UbuntuHelp:RcLocalHowto|한국어| [[::RcLocalHowto/ko|한국어]]}}|}} {{#ifexist: {{#if: UbuntuHelp:RcLocalHowto | UbuntuHelp:RcLocalHowto | {{#if: | :}}RcLocalHowto}}/ksh | • {{#if: UbuntuHelp:RcLocalHowto|Ripoarisch| [[::RcLocalHowto/ksh|Ripoarisch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:RcLocalHowto | UbuntuHelp:RcLocalHowto | {{#if: | :}}RcLocalHowto}}/mr | • {{#if: UbuntuHelp:RcLocalHowto|मराठी| [[::RcLocalHowto/mr|मराठी]]}}|}} {{#ifexist: {{#if: UbuntuHelp:RcLocalHowto | UbuntuHelp:RcLocalHowto | {{#if: | :}}RcLocalHowto}}/ms | • {{#if: UbuntuHelp:RcLocalHowto|Bahasa Melayu| [[::RcLocalHowto/ms|Bahasa Melayu]]}}|}} {{#ifexist: {{#if: UbuntuHelp:RcLocalHowto | UbuntuHelp:RcLocalHowto | {{#if: | :}}RcLocalHowto}}/nl | • {{#if: UbuntuHelp:RcLocalHowto|Nederlands| [[::RcLocalHowto/nl|Nederlands]]}}|}} {{#ifexist: {{#if: UbuntuHelp:RcLocalHowto | UbuntuHelp:RcLocalHowto | {{#if: | :}}RcLocalHowto}}/no | • {{#if: UbuntuHelp:RcLocalHowto|norsk| [[::RcLocalHowto/no|norsk]]}}|}} {{#ifexist: {{#if: UbuntuHelp:RcLocalHowto | UbuntuHelp:RcLocalHowto | {{#if: | :}}RcLocalHowto}}/oc | • {{#if: UbuntuHelp:RcLocalHowto|occitan| [[::RcLocalHowto/oc|occitan]]}}|}} {{#ifexist: {{#if: UbuntuHelp:RcLocalHowto | UbuntuHelp:RcLocalHowto | {{#if: | :}}RcLocalHowto}}/pl | • {{#if: UbuntuHelp:RcLocalHowto|polski| [[::RcLocalHowto/pl|polski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:RcLocalHowto | UbuntuHelp:RcLocalHowto | {{#if: | :}}RcLocalHowto}}/pt | • {{#if: UbuntuHelp:RcLocalHowto|português| [[::RcLocalHowto/pt|português]]}}|}} {{#ifexist: {{#if: UbuntuHelp:RcLocalHowto | UbuntuHelp:RcLocalHowto | {{#if: | :}}RcLocalHowto}}/ro | • {{#if: UbuntuHelp:RcLocalHowto|română| [[::RcLocalHowto/ro|română]]}}|}} {{#ifexist: {{#if: UbuntuHelp:RcLocalHowto | UbuntuHelp:RcLocalHowto | {{#if: | :}}RcLocalHowto}}/ru | • {{#if: UbuntuHelp:RcLocalHowto|русский| [[::RcLocalHowto/ru|русский]]}}|}} {{#ifexist: {{#if: UbuntuHelp:RcLocalHowto | UbuntuHelp:RcLocalHowto | {{#if: | :}}RcLocalHowto}}/si | • {{#if: UbuntuHelp:RcLocalHowto|සිංහල| [[::RcLocalHowto/si|සිංහල]]}}|}} {{#ifexist: {{#if: UbuntuHelp:RcLocalHowto | UbuntuHelp:RcLocalHowto | {{#if: | :}}RcLocalHowto}}/sq | • {{#if: UbuntuHelp:RcLocalHowto|shqip| [[::RcLocalHowto/sq|shqip]]}}|}} {{#ifexist: {{#if: UbuntuHelp:RcLocalHowto | UbuntuHelp:RcLocalHowto | {{#if: | :}}RcLocalHowto}}/sr | • {{#if: UbuntuHelp:RcLocalHowto|српски / srpski| [[::RcLocalHowto/sr|српски / srpski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:RcLocalHowto | UbuntuHelp:RcLocalHowto | {{#if: | :}}RcLocalHowto}}/sv | • {{#if: UbuntuHelp:RcLocalHowto|svenska| [[::RcLocalHowto/sv|svenska]]}}|}} {{#ifexist: {{#if: UbuntuHelp:RcLocalHowto | UbuntuHelp:RcLocalHowto | {{#if: | :}}RcLocalHowto}}/th | • {{#if: UbuntuHelp:RcLocalHowto|ไทย| [[::RcLocalHowto/th|ไทย]]}}|}} {{#ifexist: {{#if: UbuntuHelp:RcLocalHowto | UbuntuHelp:RcLocalHowto | {{#if: | :}}RcLocalHowto}}/tr | • {{#if: UbuntuHelp:RcLocalHowto|Türkçe| [[::RcLocalHowto/tr|Türkçe]]}}|}} {{#ifexist: {{#if: UbuntuHelp:RcLocalHowto | UbuntuHelp:RcLocalHowto | {{#if: | :}}RcLocalHowto}}/vi | • {{#if: UbuntuHelp:RcLocalHowto|Tiếng Việt| [[::RcLocalHowto/vi|Tiếng Việt]]}}|}} {{#ifexist: {{#if: UbuntuHelp:RcLocalHowto | UbuntuHelp:RcLocalHowto | {{#if: | :}}RcLocalHowto}}/yue | • {{#if: UbuntuHelp:RcLocalHowto|粵語| [[::RcLocalHowto/yue|粵語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:RcLocalHowto | UbuntuHelp:RcLocalHowto | {{#if: | :}}RcLocalHowto}}/zh | • {{#if: UbuntuHelp:RcLocalHowto|中文| [[::RcLocalHowto/zh|中文]]}}|}} {{#ifexist: {{#if: UbuntuHelp:RcLocalHowto | UbuntuHelp:RcLocalHowto | {{#if: | :}}RcLocalHowto}}/zh-hans | • {{#if: UbuntuHelp:RcLocalHowto|中文(简体)| [[::RcLocalHowto/zh-hans|中文(简体)]]}}|}} {{#ifexist: {{#if: UbuntuHelp:RcLocalHowto | UbuntuHelp:RcLocalHowto | {{#if: | :}}RcLocalHowto}}/zh-hant | • {{#if: UbuntuHelp:RcLocalHowto|中文(繁體)| [[::RcLocalHowto/zh-hant|中文(繁體)]]}}|}} |
{{#ifeq:UbuntuHelp:RcLocalHowto|:RcLocalHowto|请不要直接编辑翻译本页,本页将定期与来源同步。}} |
{{#ifexist: :RcLocalHowto/zh | | {{#ifexist: RcLocalHowto/zh | | {{#ifeq: {{#titleparts:RcLocalHowto|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:RcLocalHowto|1|-1|}} | zh | | }}
An rc.local equivalent 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.