关于服务程序(service)的命令(windows\linux)
来源:互联网 发布:完成端口 编辑:程序博客网 时间:2024/06/10 02:34
一、在windows系统中,操作服务有 net 和 sc 两个命令:
1、net用于打开没有被禁用的服务,
NET命令是功能强大的以命令行方式执行的工具。它包含了管理网络环境、服务、用户、登陆大部分重要的管理功能,使用它可以轻松的管理本地或者远程计算机的网络环境,以及各种服务程序的运行和配置,或者进行用户管理和登陆管理等。关于这些完全可以写一篇20页以上的文档了。。。。
启动和关闭服务的时候,其语法是:
net start 服务名
net stop 服务名
2、用sc可打开被禁用的服务。
sc是用于与服务控制管理器和服务进行通信的命令行程序,其语法是:
sc config 服务名 start= demand //手动
sc condig 服务名 start= auto //自动
sc config 服务名 start= disabled //禁用
sc start 服务名
sc stop 服务名
3、net 和 sc 的区别
区别1:sc(service control),专门用于管理 windows NT service , net 具有基本服务管理功能,除此之后还有其他功能,具体见帮助 “net /?”
区别2:sc为异步操作,net为同步操作,例如在批处理中重启服务,执行下面的命令:
sc stop serviceName
sc start serviceName —— 这里启动服务会失败,因为sc stop执行后马上返回,此时服务正处于“停止中”,而不是“已停止” ,所在这是 sc start 会失败
此时应用 net 命令
net stop serviceName —— 等待服务 “已停止”后 再往下执行
net start serviceName ——走到这里服务应该为“已停止”
二、在linux系统中,操作服务有service与chkconfig命令
service 相当于 windows中的 net ,基本的操作 :启动、停止、重启等……
chkconfig 相当于 windows中的 sc ,管理服务,侧重添加、删除、修改服务属性等……
1、service 命令 用法,参见 service --help
例1:当修改了主机名、ip地址等信息时,经常需要把网络重启使之生效。
service network start/stop/restart/reload/status
其中:network 为服务名,类似httpd、mysqld、httpd等
start/stop/restart/reload/status 为动作:
start——启动
stop——停止
restart——重启
reload——重新加载配置,在服务的配置文件有改动时,需要执行此命令
status——查看服务状态
2、chkconfig 命令 用法,参见chkconfig --help
- 关于服务程序(service)的命令(windows\linux)
- C# 编写Windows Service(windows服务程序)
- C# 编写Windows Service(windows服务程序)
- C# 编写Windows Service(windows服务程序)
- C# 编写Windows Service(windows服务程序)
- C# 编写Windows Service(windows服务程序)
- C# 编写Windows Service(windows服务程序)
- Windows Service服务程序的原理及实现(0)服务主函数 & 控制处理函数
- 开发Linux 服务程序与windows service程序的主要区别
- linux 配置服务的命令service
- 一个定时网络唤醒的Windows 2000服务(Service)程序
- 一个定时网络唤醒的Windows 2000服务(Service)程序
- Windows Service服务程序的原理及实现(1)实现对服务的控制和管理
- C# windows服务:通过cmd命令安装、卸载、启动和停止Windows Service(InstallUtil.exe)
- C# windows服务:通过cmd命令安装、卸载、启动和停止Windows Service(InstallUtil.exe)
- C# windows服务:通过cmd命令安装、卸载、启动和停止Windows Service(InstallUtil.exe)
- C# windows服务:通过cmd命令安装、卸载、启动和停止Windows Service(InstallUtil.exe)
- C# windows服务:通过cmd命令安装、卸载、启动和停止Windows Service(InstallUtil.exe)
- uva 699 The Falling Leaves(建二叉树同时求和)
- linux 2>&1
- GRE写作必备句型
- 类模板以及基类的也是模板的使用方法
- Linux_安装部署MySQL5.6
- 关于服务程序(service)的命令(windows\linux)
- OC学习笔记之@property关键字
- PAT (Basic Level) Practise (中文)1012. 数字分类 (20) C语言
- Spring MVC 4.1.4 RESTFUL风格返回JSON数据406错误处理 .
- 多态
- android 实现代码混淆
- Leading and Trailing
- 异步的HTTP POST与GET请求例子
- python 中 高阶函数