Welcome 微信登录

首页 / 操作系统 / Linux / Linux中service命令和/etc/init.d/的关系

service xxx启动 /etc/init.d/ 目录下的xxx脚本
如一个脚本名为 mysvc保存在/etc/init.d/下可以用 service mysvc 运行mysvc脚本
echo passed in option $0 $1if [ $1 = "start" ]
then
        echo myservice started........................................
elif [ $1 = "stop" ]
then
        echo myservice stoped........................................
else
        echo myservice not supported option........................................fi
[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........................................将RHEL5/CentOS5的GNOME改成KDERedHat 6u机器的redhat.repo文件相关资讯      Linux命令 
  • 48 字节命令可令 Linux 系统当机!  (今 07:55)
  • 在Linux笔记本上执行这句命令能致  (02月02日)
  • .NET开发必会的Linux命令  (12/20/2015 10:32:03)
  • 运维工程师必会的109个Linux命令  (03月09日)
  • 有趣的Linux命令行:随机输出唐诗  (12/28/2015 20:14:23)
  • 10 个 Linux 中的 passwd 命令示例  (10/29/2015 10:14:30)
本文评论 查看全部评论 (0)
表情: 姓名: 字数