天天看點

Example LINUX init Script

From time to time, people want me to create LINUX init scripts for them. I usually just take an existing one for another service and change it up to work for my new application, but most of them have become so long these days that I end up having to hack out a ton of code just to reduce them down to the very basic script I need. I decided to create this very simple template so I wouldn’t have to keep trimming down the more complex scripts that one tends to find in<code>/etc/init.d</code>these days.

This script iscompatible, so call it the name of your new service and put it in<code>/etc/init.d</code>

The<code>chkconfig: 235</code>section indicates the the default runlevels. For instance, if we called this script<code>/etc/init.d/new-service</code>and ran<code>chkconfig new-service on</code>, it would be active in runlevels 2,3 and 5.

The<code>98</code>and<code>55</code>numbers indicate the order of startup and kill. This means that using this tag, the startup symbolic link would be named<code>S98new-service</code>and the symbolic link to kill the process would be named<code>K55new-service</code>.

#### SNIP ####

<code></code>

本文出自 “” 部落格,請務必保留此出處

繼續閱讀