Welcome 微信登录

首页 / 操作系统 / Linux / SUSE 与 RedHat init.d 脚本文件的区别

Linux下,子启动服务需要在/etc/init.d目录下生成脚本文件,用以响应start/stop/restart操作。Linux在启动时,有几个不同的run level,分别为0~6.0  Halt Shuts down the system.
1  Single-User Mode Mode for administrative tasks
2  Multi-User Mode Does not configure network interfaces and does not export networks services.
3  Multi-User Mode with Networking Starts the system normally
4  Not used/User-definable For special purposes.
5  Start the system normally with appropriate display manager. As runlevel 3 + display manager .
6  Reboot Reboots the system. 我们需要告诉系统在什么级别下运行某个服务,以及运行的次序。RedHat下,通过在init.d 脚本文件中如下指定:#chkconfig 345 20 80, 其中,345表示在run level3,4,5启动该服务,20表示启动优先级,80表示关闭优先级。而在SUSE下使用isserv来加载服务,使用如下格式:### BEGIN INIT INFO
# Provides:          FOO
# Required-Start:    $syslog $remote_fs
# Required-Stop:     $syslog $remote_fs
# Default-Start:     3 5
# Default-Stop:      0 1 2 6
# Description:       Start FOO to allow XY and provide YZ
### END INIT INFO这里有一点不同,chkconfig通过制定优先级来确定启动顺序,insserv通过制定依赖的服务来制定。我们可以在/etc/insserv.conf中找到可以使用的系统模块名称:$syslog, $network, $time, $portmap, $local_fs, $ALL表示所有服务, $null 表示空*_Stop如果为空,默认和*_Start一致。可以使用$null设置为空。LSB(Linux Standard Base Specification)insserv (init system service)RedHat Linux开启路由功能及IP设置分享两张 Ubuntu 11.04 Unity 的快捷键图相关资讯      redhat  suse 
  • 你还记得那只可爱的小蜥蜴吗?没错  (10/26/2015 20:24:36)
  • 专访SUSE总裁Nils:让开源基因深入  (12/03/2014 18:44:03)
  • RedHat Linux 用户登录认证失败  (06/24/2014 19:56:55)
  • 为什么像 RedHat 那样的开源旗手很  (12/23/2014 07:50:53)
  • SUSE Linux再次易主,母公司被上市  (09/16/2014 20:09:38)
  • Linux选型:开源是趋势 红帽SUSE最  (03/19/2014 08:30:25)
本文评论 查看全部评论 (0)
表情: 姓名: 字数