Linux中加入开机启动的服务

首先在/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了

原文地址:https://www.cnblogs.com/chinacloud/p/1796217.html