Linux中加入開機啟動的服務

來源:互聯網
上載者:User

首先在/etc/init.d中加入描述服務的指令檔,我需要開機啟動svn服務,所以我的指令檔為svn:

#!/bin/bash
#chkconfig: 35 81 71
#description:svn service in init.d
svnserve --daemon --root=/svn/repos --listen-port=3690

 

chkconfig的格式為:chkconfig:[runlevel]  [start number]  [stop number]

然後利用chkconfig將此守護進程加入服務列表中:

chkconfig --add svn

chkconfig svn on

chkconfig --list svn後應該列出在35已開放服務的狀態為on。

find /etc/rc.d/ -type l | grep svn | sort

可列出不同等級的連結檔案。

 

然後chmod 755 svn,改變svn指令碼為可執行。

這樣就ok了。

 

可以利用chkconfig --del svn刪掉該服務。

然後rm /etc/init.d/svn。

 

忘記加入chkconfig xxx_service on了

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.