Summary: Do not try to control processes directly with Puppet and instead
properly integrate your service into your operating system.

-----

It sounds like you are misunderstanding how Puppet integrates into the rest
of the system.  Puppet should not "kill processes" directly like you would
with the 'kill' command (actually, it can, but this is almost certainly NOT
what you want).  I think you may also be misunderstanding some basic
concepts of running a Linux/Unix server.

A process is not the same thing as a service.  A single service may have
many processes, and they are typically controlled by a script in the
/etc/init.d directory (or maybe somewhere else if you are on a newfangled
system running systemd).  If your process does not have a control script in
/etc/init.d, then is is NOT a "service", it's just a process you happen to
have running for a long time.  For Puppet to consider it a service, it must
be controllable using the 'service' command (on RedHat based systems), or
the equivalent for your version of Linux/Unix.

What you really want is to be making and installing a bash script to
control your java process in /etc/init.d.  Once written, you can use Puppet
to install the script by using the "file" resource.  After you have that
done, then you can use the "service" resource to control the service as you
are tying to do.  The name of the service will be the name that you call
your script in /etc/init.d, for example: /etc/init.d/my_service.  Please do
not call your service "java", as it makes no sense to name a service after
the programming language it is written in.  If it's an accounting system
for example, call the service "accounting_system", or something like that.


You are bound to get some other replies telling you how to use an 'exec'
resource to call the "kill" command, etc..., since this is *possible* with
Puppet, but it is grossly abusive of its capabilities and you really should
not be doing that.  Please do this correctly by setting up your software as
a real service and then control it correctly with the "service" resource in
Puppet.

I strongly suggest you walk through the Puppet tutorials at
https://puppetlabs.com/learn before trying to control your own custom
applications with it.


❧ Brian Mathis
@orev


On Fri, Jun 20, 2014 at 6:02 AM, Satish Katuru <[email protected]>
wrote:

> Hi,
>
> I am new to Puppet and We are trying to stop and start any one of the
> services running on the Puppet master /agent machine.
>
> Here is the Scenario:
>
>
> 1. we have a Jboss service running on Puppet master and I am trying to
> kill this service thru puppet.(this service is runnning with my userid)
>
> Service name is "java".
>
> 2. In /etc/puppet/manifests/nodes.pp I have written code like this
>
> node "servername"
> {
>
> Service {
>
> "java":
> ensure = >"Stopped",
>
> }
> }
>
> after this I ran this command
>
> puppet apply nodes.pp
>
> Nothing has happend.Still the process is running.(I am able to see the
> process id : ps -ef|grep java)
>
> 3.After this i created a module and place this code in init.pp in
> /etc/puppet/modues/httpd/
>
> node "servername"
> {
> inlcude httpd
> }
>
> puppet apply nodes.pp
>
>
> Nothing happend.
>
> Can you please guide us how to kill a process?
>
>
>
>
>
>
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/c81e168e-38f0-416c-b0c2-bd0124c9e760%40googlegroups.com
> <https://groups.google.com/d/msgid/puppet-users/c81e168e-38f0-416c-b0c2-bd0124c9e760%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CALKwpEzK-VLedCmo69J25eNPXRS2zsqbSy%3DErzar5fVftJ-dgA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to