blog/content/post/2009/04/12/2009-04-12-00001140.md

55 lines
2.1 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: debianでOS起動時に実行するスクリプトを管理する
author: kazu634
date: 2009-04-12
url: /2009/04/12/_1226/
wordtwit_post_info:
- 'O:8:"stdClass":13:{s:6:"manual";b:0;s:11:"tweet_times";i:1;s:5:"delay";i:0;s:7:"enabled";i:1;s:10:"separation";s:2:"60";s:7:"version";s:3:"3.7";s:14:"tweet_template";b:0;s:6:"status";i:2;s:6:"result";a:0:{}s:13:"tweet_counter";i:2;s:13:"tweet_log_ids";a:1:{i:0;i:4557;}s:9:"hash_tags";a:0:{}s:8:"accounts";a:1:{i:0;s:7:"kazu634";}}'
categories:
- debian
- linux
---
<div class="section">
<p>
次のようにupdate-rc.dコマンドを用いると、OS起動時に実行するスクリプトを管理できます。
</p>
<blockquote title="init.d 起動スクリプト " cite="http://linuxer.seesaa.net/article/41636114.html">
<pre class="syntax-highlight">
<span class="synComment"># update-rc.d &#60;スクリプト名&#62; defaults &#60;システム起動時順序&#62; &#60;システム停止時順序&#62;</span>
<span class="synComment"># update-rc.d myscript.sh defaults 99 1</span>
</pre>
<p>
では myscript.sh を99番目実際はスクリプトの総数によるに開始し、1番目に終わらせることを意味する。
</p>
<p>
</p>
<p>
普通のスクリプトを書く → /etc/init.d/に置く  update-rc.dで登録する
</p>
<p>
これだけで起動時自動的にスクリプトを読み込ませることができる。
</p>
<p>
<cite><a href="http://linuxer.seesaa.net/article/41636114.html" onclick="__gaTracker('send', 'event', 'outbound-article', 'http://linuxer.seesaa.net/article/41636114.html', 'init.d 起動スクリプト : 自宅運用debianサーバのTIPS+α');" target="_blank">init.d 起動スクリプト : 自宅運用debianサーバのTIPS+α</a></cite>
</p>
</blockquote>
<p>
削除したいときは、
</p>
<pre class="syntax-highlight">
update-rc.d <span class="synSpecial">-f</span> <span class="synStatement">&#60;</span>スクリプト名<span class="synStatement">&#62;</span> remove
</pre>
<p>
とします。
</p>
</div>