1、假设有这样一个脚本,且放在/etc/init.d/目录下
[[email protected] init.d]# cat oldboyd # chkconfig: 2345 57 27 # description: oldboyd is a protocol for secure remote shell access. [[email protected] init.d]# pwd /etc/init.d
2、给它执行权限
[[email protected] init.d]# chmod +x oldboyd [[email protected] init.d]# ll oldboyd -rwxr-xr-x. 1 root root 90 Jul 14 04:28 oldboyd
3、添加chkconfig管理
[[email protected] init.d]# chkconfig --add oldboyd #添加开默认是开启的 [[email protected] init.d]# chkconfig --list oldboyd oldboyd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
4、chkconfig的原理实质是软链接
[[email protected] init.d]# ll /etc/rc.d/rc3.d/|grep oldboyd lrwxrwxrwx. 1 root root 17 Jul 14 04:29 S57oldboyd -> ../init.d/oldboyd [[email protected] init.d]# chkconfig oldboyd off [[email protected] init.d]# ll /etc/rc.d/rc3.d/|grep oldboyd lrwxrwxrwx. 1 root root 17 Jul 14 04:30 K27oldboyd -> ../init.d/oldboyd
时间: 2024-10-12 05:49:19