| 
                   | 
                   
                        
                          
                            
                              |  ■ サービスの起動、停止 | 
                              2010/03/05 更新 | 
                             
                          
                         
                  
                    
                      
                         | 
                        
                        
                                
                            
                               | 
                             
                            
                                    | サービスの自動起動、手動起動、停止のコマンド
                               | 
                                   
                                  
                                    
                              
                                      
                                        
                                           | 
                                          
                                          
                                        
                                          
                                            # chkconfig --list proftpd ※1 
                                          0:off 1:off 2:off 3:off 4:off 5:off 6:off 
                                           
                                          # chkconfig --level 35 named on  ※2 
                                           
                                          # chkconfig named on ※3 
                                           
                                          # /etc/init.d/named start (RedHat系なら:service named start) ※4 
                                           
                                          # /etc/init.d/named stop  (RedHat系なら:service named stop) | 
                                               
                                            
                                           
                                          
                                            
                                              
                                                 | 
                                                ※1 | 
                                                 | 
                                                指定したサービスが自動起動するランレベルを表示する。 | 
                                         
                                              
                                                 | 
                                                ※2 | 
                                                 | 
                                                指定したサービスが自動起動するランレベルを明示的に指定する。 | 
                                         
                                              
                                                 | 
                                                ※3 | 
                                                 | 
                                                /etc/init.d/起動スクリプト で予め指定されたランレベルに対して、自動起動を設定する。 | 
                                         
                                              
                                                 | 
                                                ※4 | 
                                                 | 
                                                サービスの起動、停止を行う。 一般的な init.d の下の起動スクリプトを使おう。 | 
                                         
                                            
                                           
                                           | 
                                         
                                      
                                     
                               | 
                             
                          
                         
                          | 
                       
                    
                   
                   
                        
                          
                            
                              |  ■ サービス管理プログラム (chkconfig) | 
                              2010/03/05 更新 | 
                             
                          
                         
                  
                    
                      
                         | 
                        
                        
                                
                            
                               | 
                             
                            
                                    | サービス管理への登録、削除方法 | 
                                   
                                  
                                    設定手順
                              
                                - サービス起動/停止スクリプトを /etc/init.d の配下に準備する。
                                
 - 作成したスクリプトを編集する。
 
                                
                                  
                                    
                                      # vi /etc/init.d/proftpd
                                      
                                        
                                          
                                             | 
                                            緑:デフォルト、オレンジ:変更箇所 | 
                                           
                                          
                                            |   | 
                                            
                                            
                                              
                                                
                                                  #!/bin/sh  
                                                  # 
                                                  # Startup script for ProFTPD 
                                                  # 
                                                  # chkconfig: 345 85 15 ※1 
                                                  # description: ProFTPD is an enhanced FTP server with \ ※2 
                                                  #              a focus toward simplicity, security, and ease of configuration. \ 
                                                  #              It features a very Apache-like configuration syntax, \ 
                                                  #              and a highly customizable server infrastructure, \ 
                                                  #              including support for multiple 'virtual' FTP servers, \ 
                                                  #              anonymous FTP, and permission-based directory visibility. 
                                                  # processname: proftpd ※3 
                                                  # config: /etc/proftpd.conf ※4 
                                                  # 
                                                  以下、スクリプトに続く。 | 
                                                 
                                              
                                             
                                             | 
                                           
                                        
                                       
                                       | 
                                     
                                  
                                 
                                
                                  
                                    
                                       | 
                                      ※1 | 
                                       | 
                                      サービスの起動に関する情報 
                                      
                                        
                                          
                                            | 345 | 
                                            : | 
                                            サービス登録時に自動起動を設定するランレベルを指定する。 この場合、ランレベル3~5で自動起動される。 | 
                                           
                                          
                                            | 85 | 
                                            : | 
                                            自動起動が設定されるランレベルの rc ディレクトリ内に、起動のためのリンクが張られる。 S85proftpd ができる。 | 
                                           
                                          
                                            | 15 | 
                                            : | 
                                            自動起動が設定されるランレベルの rc ディレクトリ内に、停止のためのリンクが張られる。 K15proftpd ができる。 | 
                                           
                                        
                                       
                                       | 
                                     
                                    
                                       | 
                                      ※2 | 
                                       | 
                                      説明書きです | 
                                     
                                    
                                       | 
                                      ※3 | 
                                       | 
                                      プロセス名です | 
                                     
                                    
                                       | 
                                      ※4 | 
                                       | 
                                      設定ファイルを記述。 複数記載することも可能。 
                                      このファイルが更新されればサービスが再起動されるとの情報もあるが、そうでもないと思う。。 | 
                                     
                                  
                                 
                                 
                                 - サービスを登録
                                
                                  
                                    
                                      # chkconfig --add proftpd 
                                      # 
                                      # chkconfig --list proftpd 
                                      proftpd 0:off 1:off 2:off 3:on 4:on 5:on 6:off5 ※1 
                                      # | 
                                     
                                  
                                 
                                
                                  
                                    
                                       | 
                                      ※1 | 
                                       | 
                                      起動スクリプトで指定したランレベルで on になっている | 
                                     
                                  
                                 
                                 
                                 - サービスの起動
                                
                                  
                                    
                                      # /etc/init.d/proftpd start 
                                      Starting proftpd: [ OK ] 
                                      # | 
                                     
                                  
                                 
                                  
                                 
                                その他、サービスの削除 
                              
                                
                                  
                                     | 
                                    
                                          
                                        
                                          
                                            # chkconfig --del proftpd 
                                      # | 
                                               
                                            
                                           
                                     | 
                                   
                                
                               
                               | 
                             
                          
                         
                          | 
                       
                    
                   
                    | 
                 
              
             
              | 
           
        
       
        |