Chkconfig添加服务
来源:互联网 发布:redis重启后数据丢失 编辑:程序博客网 时间:2024/06/04 19:42
#chkconfig 2345 55 45
#上面为固定格式:2345 表示运行级别,55表示开机执行顺序,45为关机顺序
#description:this is just a demo of chkconfig script
case “$1” in
start)
#chmod a+x <myscript>
#copy <myscript> /etc/init.d
#chkconfig --add <myscript>
#chkconfig --level 35 <myscript > on
#chkconfig --list <myscript>
#service <myscript> start | stop | status
在Linux中chkconfighttpd任务添加,Apache服务器的最新稳定发布版本是httpd-2.2..0,官方下载地址是:http://httpd.apache.org/download.cgi。我们通过下面的步骤来快速的搭建一个web服务器。
1、下载源码文件httpd-2.2.0.tar.gz 到linux服务器的某个目录。
2、解压文件 # tar zxvf httpd-2.2.0.tar.gz .
3、配置 # ./configure –refix=/usr/local/apache //指定安装目录,以后要删除安装就只需删除这个目录。
4、编译和安装。 # make ; make install .
5、编写启动脚本,把它放到目录 /etc/rc.d/init.d/里,这里取名为httpd,其内容如下:
- #!/bin/bash
- #description:http server
- #chkconfig: 235 98 98
- case "$1" in
- start)
- echo "Starting Apache daemon..."
- /usr/local/apache2/bin/apachectl -k start
- ;;
- stop)
- echo "Stopping Apache daemon..."
- /usr/local/apache2/bin/apachectl -k stop
- ;;
- restart)
- echo "Restarting Apache daemon..."
- /usr/local/apache2/bin/apachectl -k restart
- ;;
- status)
- statusproc /usr/local/apache2/bin/httpd
- ;;
- *)
- echo "Usage: $0 {start|stop|restart|status}"
- exit 1
- ;;
- Esac
注意:#description:http server 这一行必须加上,否则在执行命令
# chkconfig –add httpd
时会出现“service apache does not support chkconfig”的错误报告。
#chkconfig: 2345 98 98 表示在执行命令
# chkconfig –add httpd 时会在目录 /etc/rc2.d/ 、/etc/rc3.d/ /etc/rc5.d 分别生成文件 S98httpd和 K98httpd。这个数字可以是别的。
6、执行命令 # chkconfig –add httpd ,进入目录/etc/rc3.d/检查是否生成文件 S98httpd及K98httpd.
7、启动服务 # service httpd start .
- Chkconfig 添加系统服务
- Chkconfig添加服务
- chkconfig 服务的添加、顺序
- linux 添加系统服务,chkconfig使用
- chkconfig命令和添加开机启动服务
- Linux下chkconfig命令详解即添加服务以及两种方式启动关闭系统服务
- Linux下chkconfig命令详解即添加服务以及两种方式启动关闭系统服务
- Linux下chkconfig命令详解即添加服务以及两种方式启动关闭系统服务
- Linux注册服务(chkconfig)
- 系统服务chkconfig,systemd
- 服务管理工具 chkconfig
- 服务不支持chkconfig解决方法脚本
- 服务不支持 chkconfig 的解决方法
- 服务不支持 chkconfig 的解决办法
- 服务不支持chkconfig的解决
- chkconfig 开机启动服务命令
- 服务不支持chkconfig的解决
- chkconfig删除某项服务
- 关于mit xv6
- 你是我的小苹果
- 黑马程序员-文件流IO操作
- 走进windows编程的世界-----对话框、文本框、按钮
- 内存分配方式,堆区,栈区
- Chkconfig添加服务
- 如何针对自己的需要修改caffe的网络(Python)
- 项目管理实践教程二、源代码控制【Source Control Using VisualSVN Server and TortoiseSVN】
- Java学习之Iterator(迭代器)的一般用法
- Android开发之监听发出的短信
- linux 下 postgresql 的 备份和恢复
- 为什么出现:warning: The 'compute_10' and 'sm_10' architectures are deprecated
- 让Android程序单例运行
- ESL-chapter6 核密度估计和分类