service { 'resource title':
name => # (namevar) The name of the service to run. This name is...
ensure => # Whether a service should be running. Valid...
binary => # The path to the daemon. This is only used for...
control => # The control variable used to manage services...
enable => # Whether a service should be enabled to start at...
flags => # Specify a string of flags to pass to the startup
hasrestart => # Specify that an init script has a `restart...
hasstatus => # Declare whether the service's init script has a...
manifest => # Specify a command to config a service, or a path
path => # The search path for finding init scripts....
pattern => # The pattern to search for in the process table...
provider => # The specific backend to use for this `service...
restart => # Specify a *restart* command manually. If left...
start => # Specify a *start* command manually. Most...
status => # Specify a *status* command manually. This...
stop => # Specify a *stop* command...
# ...plus any applicable metaparameters.
}
[iyunv@sh-web1 ~]# puppet apply mysqld.pp
Notice: Compiled catalog for sh-web1.localdomain in environment production in 0.06 seconds
Notice: /Stage[main]/Main/Service[mysqld]/ensure: ensure changed 'stopped' to 'running'
Notice: Finished catalog run in 2.44 seconds
查看结果是否启动.
1
2
[iyunv@sh-web1 ~]# /etc/init.d/mysqld status
MySQL running (123039) [ OK ]