Linux中service命令和/etc/init.d/的关系
service xxx启动 /etc/init.d/ 目录下的xxx脚本
如一个脚本名为 mys
vc保存在/etc/init.d/下可以用 service mysvc 运行mysvc脚本
echo passed in option $0 $1
if [ $1 = "start" ]
then
echo myservice started........................................
elif [ $1 = "stop" ]
then
echo myservice stoped........................................
else
echo myservice not supported option........................................
fi www.2cto.com
[root@localhost init.d]# service mysvc start
passed in option /etc/init.d/mysvc start
myservice started........................................
[root@localhost init.d]# service mysvc stop
passed in option /etc/init.d/mysvc stop
myservice stoped........................................
[root@localhost init.d]# service mysvc xxx
passed in option /etc/init.d/mysvc xxx
myservice not supported option........................................
本文详细介绍了 Linux 中 service 命令的工作原理及其与 /etc/init.d/ 目录下脚本的关系。通过一个具体的示例 myserv,演示了如何使用 service 命令来启动、停止和管理服务。
1561

被折叠的 条评论
为什么被折叠?



