Linux 服务集中管理工具ntsysv

简介:


作者:田逸([email]sery@163.com[/email]

 
Ntsysvredhat 提供的集中管理系统各种服务的工具,在RedHat各个发行版,centos各个版本,都自带这个工具。比起solaris 10SMF来,要方便很多了,因为ntsysv一次就可以选中或取消多个服务,而svcadmin只能一个一个的来。
 
RedHat2种方法启用ntsysv:一种是直接在命令行下执行命令 ntsysv,另外一种是执行setup命令间接进入。不管是哪种方式进入,其结果都是相同的。下面用图示来说明一下这个过程。
回车后出现下列菜单:
光标定位System services ,再按“Tab”键选“Run Tool”,也可以直接回车。
用空白键(最长的那个)选中或取消服务。选中时,服务的前面的方括号里是“ * ”,反之则表示取消。设置完毕后,按“ Tab ”到“ ok ”回车结束配置。如果直接执行命令 ntsysv, 步骤就比 setup 少。
 
 
当我们使用 ntsysv 管理服务时,究竟后面进行的实质是什么?进入当前运行目录 /etc/rc3.d( 我的系统当前运行级别是 3 ,运行命令  who –r 查看之 ) ,用命令  ll  列出所有的目录,然后统计一下目录 / 文件数目:
[root@myest rc3.d]# ll
total 4
lrwxrwxrwx  1 root root 21 Oct 18 12:17 K01tog-pegasus -> ../init.d/tog-pegasus
lrwxrwxrwx  1 root root 13 Oct 18 12:17 K01yum -> ../init.d/yum
lrwxrwxrwx  1 root root 19 Oct 18 12:17 K02haldaemon -> ../init.d/haldaemon
lrwxrwxrwx  1 root root 24 Oct 18 12:17 K02NetworkManager -> ../init.d/NetworkManager
lrwxrwxrwx  1 root root 20 Oct 18 12:17 K03messagebus -> ../init.d/messagebus
lrwxrwxrwx  1 root root 15 Oct 18 12:17 K03rhnsd -> ../init.d/rhnsd
lrwxrwxrwx  1 root root 17 Oct 18 12:17 K05anacron -> ../init.d/anacron
lrwxrwxrwx  1 root root 14 Oct 18 12:17 K10cups -> ../init.d/cups
lrwxrwxrwx  1 root root 16 Oct 18 12:17 K10psacct -> ../init.d/psacct
lrwxrwxrwx  1 root root 13 Oct 18 12:17 K10xfs -> ../init.d/xfs
lrwxrwxrwx  1 root root 13 Oct 18 12:17 K15gpm -> ../init.d/gpm
lrwxrwxrwx  1 root root 14 Oct 18 12:17 K17iiim -> ../init.d/iiim
lrwxrwxrwx  1 root root 13 Oct 18 12:17 K20nfs -> ../init.d/nfs
lrwxrwxrwx  1 root root 14 Oct 18 12:17 K24irda -> ../init.d/irda
lrwxrwxrwx  1 root root 22 Oct 18 12:17 K30courier-imap -> ../init.d/courier-imap
lrwxrwxrwx  1 root root 17 Oct 18 12:17 K35winbind -> ../init.d/winbind
lrwxrwxrwx  1 root root 16 Oct 18 12:17 K40smartd -> ../init.d/smartd
lrwxrwxrwx  1 root root 20 Oct 18 12:17 K44rawdevices -> ../init.d/rawdevices
lrwxrwxrwx  1 root root 16 Oct 18 12:17 K50ibmasm -> ../init.d/ibmasm
lrwxrwxrwx  1 root root 17 Oct 18 12:17 K50netdump -> ../init.d/netdump
lrwxrwxrwx  1 root root 16 Oct 18 12:17 K50xinetd -> ../init.d/xinetd
lrwxrwxrwx  1 root root 15 Oct 18 12:17 K56acpid -> ../init.d/acpid
lrwxrwxrwx  1 root root 19 Oct 18 12:17 K68rpcidmapd -> ../init.d/rpcidmapd
lrwxrwxrwx  1 root root 17 Oct 18 12:17 K69rpcgssd -> ../init.d/rpcgssd
lrwxrwxrwx  1 root root 16 Oct 18 12:17 K72autofs -> ../init.d/autofs
lrwxrwxrwx  1 root root 16 Oct 18 12:17 K73ypbind -> ../init.d/ypbind
lrwxrwxrwx  1 root root 14 Oct 18 12:17 K74apmd -> ../init.d/apmd
lrwxrwxrwx  1 root root 14 Oct 18 12:17 K74nscd -> ../init.d/nscd
lrwxrwxrwx  1 root root 14 Oct 18 12:17 K74ntpd -> ../init.d/ntpd
lrwxrwxrwx  1 root root 15 Oct 18 12:17 K75netfs -> ../init.d/netfs
lrwxrwxrwx  1 root root 25 Oct 18 12:17 K85courier-authlib -> ../init.d/courier-authlib
lrwxrwxrwx  1 root root 19 Oct 18 12:17 K85mdmonitor -> ../init.d/mdmonitor
lrwxrwxrwx  1 root root 15 Oct 18 12:17 K85mdmpd -> ../init.d/mdmpd
lrwxrwxrwx  1 root root 17 Oct 18 12:17 K86nfslock -> ../init.d/nfslock
lrwxrwxrwx  1 root root 16 Oct 18 12:17 K87auditd -> ../init.d/auditd
lrwxrwxrwx  1 root root 20 Oct 18 12:17 K87irqbalance -> ../init.d/irqbalance
lrwxrwxrwx  1 root root 17 Oct 18 12:17 K87portmap -> ../init.d/portmap
lrwxrwxrwx  1 root root 18 Oct 18 12:17 K89netplugd -> ../init.d/netplugd
lrwxrwxrwx  1 root root 19 Oct 18 12:17 K90bluetooth -> ../init.d/bluetooth
lrwxrwxrwx  1 root root 14 Oct 18 12:17 K91isdn -> ../init.d/isdn
lrwxrwxrwx  1 root root 22 Oct 18 12:17 K92arptables_jf -> ../init.d/arptables_jf
lrwxrwxrwx  1 root root 18 Oct 18 12:17 K92iptables -> ../init.d/iptables
lrwxrwxrwx  1 root root 18 Oct 18 12:17 K94diskdump -> ../init.d/diskdump
lrwxrwxrwx  1 root root 15 Oct 18 12:17 K95kudzu -> ../init.d/kudzu
lrwxrwxrwx  1 root root 17 Oct 18 12:17 K95openibd -> ../init.d/openibd
lrwxrwxrwx  1 root root 14 Oct 18 12:17 K96ipmi -> ../init.d/ipmi
lrwxrwxrwx  1 root root 16 Oct 18 12:17 K96pcmcia -> ../init.d/pcmcia
lrwxrwxrwx  1 root root 18 Oct 18 12:17 K99cpuspeed -> ../init.d/cpuspeed
lrwxrwxrwx  1 root root 23 Oct 18 12:17 K99microcode_ctl -> ../init.d/microcode_ctl
lrwxrwxrwx  1 root root 19 Oct 18 12:17 K99readahead -> ../init.d/readahead
lrwxrwxrwx  1 root root 25 Oct 18 12:17 K99readahead_early -> ../init.d/readahead_early
lrwxrwxrwx  1 root root 17 Oct 18 12:17 S10network -> ../init.d/network
lrwxrwxrwx  1 root root 16 Oct 18 12:17 S12syslog -> ../init.d/syslog
lrwxrwxrwx  1 root root 14 Oct 18 12:17 S55sshd -> ../init.d/sshd
lrwxrwxrwx  1 root root 15 Oct 18 12:17 S90crond -> ../init.d/crond
lrwxrwxrwx  1 root root 13 Oct 18 12:17 S95atd -> ../init.d/atd
lrwxrwxrwx  1 root root 11 Jul 30 13:23 S99local -> ../rc.local
全是链接文件,真实的文件在目录 /etc/init.d 呢。
[root@myest rc3.d]# ll | wc -l
58
现在 /etc/rc3.d 目录有 58 个链接文件。接下来,我们使用 ntsysv 添加一个服务,如“ kuzdu ”,执行完毕后,再查目录 /etc/rc3.d ,其结果如下:
[root@myest rc3.d]# ll                                                        
total 4
lrwxrwxrwx  1 root root 21 Dec 20 14:24 K01tog-pegasus -> ../init.d/tog-pegasus
lrwxrwxrwx  1 root root 13 Dec 20 14:24 K01yum -> ../init.d/yum
lrwxrwxrwx  1 root root 19 Dec 20 14:24 K02haldaemon -> ../init.d/haldaemon
lrwxrwxrwx  1 root root 24 Dec 20 14:24 K02NetworkManager -> ../init.d/NetworkManager
lrwxrwxrwx  1 root root 20 Dec 20 14:24 K03messagebus -> ../init.d/messagebus
lrwxrwxrwx  1 root root 15 Dec 20 14:24 K03rhnsd -> ../init.d/rhnsd
lrwxrwxrwx  1 root root 17 Dec 20 14:24 K05anacron -> ../init.d/anacron
lrwxrwxrwx  1 root root 14 Dec 20 14:24 K10cups -> ../init.d/cups
lrwxrwxrwx  1 root root 16 Dec 20 14:24 K10psacct -> ../init.d/psacct
lrwxrwxrwx  1 root root 13 Dec 20 14:24 K10xfs -> ../init.d/xfs
lrwxrwxrwx  1 root root 13 Dec 20 14:24 K15gpm -> ../init.d/gpm
lrwxrwxrwx  1 root root 14 Dec 20 14:24 K17iiim -> ../init.d/iiim
lrwxrwxrwx  1 root root 13 Dec 20 14:24 K20nfs -> ../init.d/nfs
lrwxrwxrwx  1 root root 14 Dec 20 14:24 K24irda -> ../init.d/irda
lrwxrwxrwx  1 root root 22 Dec 20 14:24 K30courier-imap -> ../init.d/courier-imap
lrwxrwxrwx  1 root root 17 Dec 20 14:24 K35winbind -> ../init.d/winbind
lrwxrwxrwx  1 root root 16 Dec 20 14:24 K40smartd -> ../init.d/smartd
lrwxrwxrwx  1 root root 20 Dec 20 14:24 K44rawdevices -> ../init.d/rawdevices
lrwxrwxrwx  1 root root 16 Dec 20 14:24 K50ibmasm -> ../init.d/ibmasm
lrwxrwxrwx  1 root root 17 Dec 20 14:24 K50netdump -> ../init.d/netdump
lrwxrwxrwx  1 root root 16 Dec 20 14:24 K50xinetd -> ../init.d/xinetd
lrwxrwxrwx  1 root root 15 Dec 20 14:24 K56acpid -> ../init.d/acpid
lrwxrwxrwx  1 root root 19 Dec 20 14:24 K68rpcidmapd -> ../init.d/rpcidmapd
lrwxrwxrwx  1 root root 17 Dec 20 14:24 K69rpcgssd -> ../init.d/rpcgssd
lrwxrwxrwx  1 root root 16 Dec 20 14:24 K72autofs -> ../init.d/autofs
lrwxrwxrwx  1 root root 16 Dec 20 14:24 K73ypbind -> ../init.d/ypbind
lrwxrwxrwx  1 root root 14 Dec 20 14:24 K74apmd -> ../init.d/apmd
lrwxrwxrwx  1 root root 14 Dec 20 14:24 K74nscd -> ../init.d/nscd
lrwxrwxrwx  1 root root 14 Dec 20 14:24 K74ntpd -> ../init.d/ntpd
lrwxrwxrwx  1 root root 15 Dec 20 14:24 K75netfs -> ../init.d/netfs
lrwxrwxrwx  1 root root 25 Dec 20 14:24 K85courier-authlib -> ../init.d/courier-authlib
lrwxrwxrwx  1 root root 19 Dec 20 14:24 K85mdmonitor -> ../init.d/mdmonitor
lrwxrwxrwx  1 root root 15 Dec 20 14:24 K85mdmpd -> ../init.d/mdmpd
lrwxrwxrwx  1 root root 17 Dec 20 14:24 K86nfslock -> ../init.d/nfslock
lrwxrwxrwx  1 root root 16 Dec 20 14:24 K87auditd -> ../init.d/auditd
lrwxrwxrwx  1 root root 20 Dec 20 14:24 K87irqbalance -> ../init.d/irqbalance
lrwxrwxrwx  1 root root 17 Dec 20 14:24 K87portmap -> ../init.d/portmap
lrwxrwxrwx  1 root root 18 Dec 20 14:24 K89netplugd -> ../init.d/netplugd
lrwxrwxrwx  1 root root 19 Dec 20 14:24 K90bluetooth -> ../init.d/bluetooth
lrwxrwxrwx  1 root root 14 Dec 20 14:24 K91isdn -> ../init.d/isdn
lrwxrwxrwx  1 root root 22 Dec 20 14:24 K92arptables_jf -> ../init.d/arptables_jf
lrwxrwxrwx  1 root root 18 Dec 20 14:24 K92iptables -> ../init.d/iptables
lrwxrwxrwx  1 root root 18 Dec 20 14:24 K94diskdump -> ../init.d/diskdump
lrwxrwxrwx  1 root root 17 Dec 20 14:24 K95openibd -> ../init.d/openibd
lrwxrwxrwx  1 root root 14 Dec 20 14:24 K96ipmi -> ../init.d/ipmi
lrwxrwxrwx  1 root root 16 Dec 20 14:24 K96pcmcia -> ../init.d/pcmcia
lrwxrwxrwx  1 root root 18 Dec 20 14:24 K99cpuspeed -> ../init.d/cpuspeed
lrwxrwxrwx  1 root root 23 Dec 20 14:24 K99microcode_ctl -> ../init.d/microcode_ctl
lrwxrwxrwx  1 root root 19 Dec 20 14:24 K99readahead -> ../init.d/readahead
lrwxrwxrwx  1 root root 25 Dec 20 14:24 K99readahead_early -> ../init.d/readahead_early
lrwxrwxrwx  1 root root 15 Dec 20 14:24 S05kudzu -> ../init.d/kudzu
lrwxrwxrwx  1 root root 17 Dec 20 14:24 S10network -> ../init.d/network
lrwxrwxrwx  1 root root 16 Dec 20 14:24 S12syslog -> ../init.d/syslog
lrwxrwxrwx  1 root root 14 Dec 20 14:24 S55sshd -> ../init.d/sshd
lrwxrwxrwx  1 root root 15 Dec 20 14:24 S90crond -> ../init.d/crond
lrwxrwxrwx  1 root root 13 Dec 20 14:24 S95atd -> ../init.d/atd
lrwxrwxrwx  1 root root 11 Jul 30 13:23 S99local -> ../rc.local
从输出可以看见多了一个文件  S05kudzu, 文件个数现在是 59 ,确实是多了一个。再运行工具 ntsysv 把这个服务取消,这时目录 /etc/rc3.d 将删除链接文件 S05kuzdu 。由此我们可以得出结论, ntsysv 的作用就是把目录 /etc/init.d 的文件在相应运行级别的目录创建或删除链接文件。
 
懂得这个原理后,我们用手工的方法也可以完成这个操作,而且可以把这个方法运用在各种 unix/linux 操作系统,要程序随系统开机启动就不是难事了。
 


















本文转自sery51CTO博客,原文链接:http://blog.51cto.com/sery/55968 ,如需转载请自行联系原作者
相关文章
|
16天前
|
监控 Unix Linux
Linux操作系统调优相关工具(四)查看Network运行状态 和系统整体运行状态
Linux操作系统调优相关工具(四)查看Network运行状态 和系统整体运行状态
30 0
|
23天前
|
存储 前端开发 Linux
Linux系统之部署ToDoList任务管理工具
【4月更文挑战第1天】Linux系统之部署ToDoList任务管理工具
63 1
|
25天前
|
存储 传感器 运维
linux系统资源统计工具
【4月更文挑战第1天】Linux系统监控工具如dstat、htop、glances、vmstat、top、iostat、mpstat、sar和atop,用于跟踪CPU、内存、磁盘I/O、网络和进程性能。这些工具提供实时、交互式和历史数据分析,助力管理员优化系统性能和故障排查。例如,dstat是vmstat等工具的增强版,htop提供彩色界面的进程管理,而atop则结合了多种功能并记录历史数据。
28 5
linux系统资源统计工具
|
16天前
|
Linux
Linux操作系统调优相关工具(三)查看IO运行状态相关工具 查看哪个磁盘或分区最繁忙?
Linux操作系统调优相关工具(三)查看IO运行状态相关工具 查看哪个磁盘或分区最繁忙?
21 0
|
1天前
|
JSON Unix Linux
Linux系统之jq工具的基本使用
Linux系统之jq工具的基本使用
24 1
|
2天前
|
监控 安全 Linux
Linux系统之安装ServerBee服务器监控工具
【4月更文挑战第22天】Linux系统之安装ServerBee服务器监控工具
40 2
|
2天前
|
编解码 Linux 数据安全/隐私保护
linux工具之curl与wget高级使用
linux工具之curl与wget高级使用
|
9天前
|
存储 关系型数据库 MySQL
Linux服务详解
Linux服务详解
25 0
|
10天前
|
网络协议 Ubuntu Linux
Linux 下 TFTP 服务搭建及 U-Boot 中使用 tftp 命令实现文件下载
Linux 下 TFTP 服务搭建及 U-Boot 中使用 tftp 命令实现文件下载
|
18天前
|
监控 Java Linux
linux下监控java进程 实现自动重启服务
linux下监控java进程 实现自动重启服务