SaltStack源码分析之service状态模块
/usr/lib/python2.6/site-packages/salt/states/service.py这个模块用于启动或重启服务和后台进程
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
starting or restarting of services and daemons
==============================================
Services are defined as system daemons typically started with system init or
rc scripts, services can be defined as running or dead.
.. code-block:: yaml
httpd:
service:
- running
The service can also be set to be started at runtime via the enable option:
.. code-block:: yaml
openvpn:
service:
- running
- enable: True
By default if a service is triggered to refresh due to a watch statement the
service is by default restarted. If the desired behavior is to reload the
service, then set the reload value to True:
.. code-block:: yaml
redis:
service:
- running
- enable: True
- reload: True
- watch:
- pkg: redis
.. note::
More details regarding ``watch`` can be found in the
:doc:`Requisites </ref/states/requisites>` documentation.
'''
主要使用到两个状态running和dead
页:
[1]